Documentation > Explore > Direct Sampling
N.B.
Contents
Uniform Distribution Sampling 🔗
Sampling can also be performed at random within a domain via aUniformDistribution(maximum).
This task generates values uniformly distributed between zero and the maximum argument. Custom domains can be defined using transformations, as in the example below that generates values between -10 and + 10.
val my_input = Val[Double]
val my_model = EmptyTask() set( (inputs, outputs) += my_input)
val exploration =
DirectSampling(
evaluation = my_model hook ToStringHook(),
sampling= (my_input in (UniformDistribution[Double](max=20) take 100)).map(x => x -10)
)
exploration
N.B.
DirectSampling usage is not limited to uniform or grid sampling, and accepts any type of more advanced sampling.