Documentation > Explore > Samplings
In the following example, 100 values are generated at random, uniformly distributed between 0 and 20.
For more information on the @code{map} function, or other transformation functions, see the Language section.
Random Sequence of Number 🔗
Samplings can be performed at random within a domain following a uniform distribution, via theRandomSequence(size, min, max)
command.
This task generates values uniformly distributed values:
In the following example, 100 values are generated at random, uniformly distributed between 0 and 20.
val my_input = Val[Double]
val my_model = EmptyTask() set( (inputs, outputs) += my_input)
val exploration =
DirectSampling(
evaluation = my_model hook display,
sampling= my_input in RandomSequence[Double](max = 20, size = 100)
)
exploration
Sample within a skewed uniform distribution 🔗
Custom domains can be defined using transformations on the uniform distribution. For instance in this next example, 100 values uniformly distributed between 0 and 20 are still generated at random, however, each one is then shifted by -10 through themap
function.
Thus, the sampling will be comprised of 100 values uniformly distributed 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 display,
sampling= my_input in RandomSequence[Double](max = 20, size = 100).map(x => x -10)
)
exploration
For more information on the @code{map} function, or other transformation functions, see the Language section.