double pick(double a, double b)
{
return a + (double)rand() / ((double)RAND_MAX * (b - a));
}
(defn rand-between [a b]
(+ a (* (- b a) (rand))))
float pick(float a, float b)
{
std::default_random_engine generator;
std::uniform_real_distribution distribution(a, b);
return distribution(generator);
}
Random rng = new();
double pick(double a, double b)
{
return rng.NextDouble() * (b - a) + a;
}
real pick(real _a, real _b){
return uniform(_a, _b);
}
double pick(num a, num b) => a + new Random().nextDouble() * (b - a);
defmodule MyRandomPicker do
def pick(a, b), do: a + (b - a) * :rand.uniform()
end
a + :rand.uniform() * (b-a)
A + (B - A) * rand:uniform().
call random_number(c)
d = a + (b-a) * c
func pick(a, b float64) float64 {
return a + (rand.Float64() * (b-a))
}
pick(a,b)=
return.(+a).(*(b-a))=<<System.Random.randomIO::IO(Double)
pick a b = do
r <- System.Random.randomIO :: IO Double
return a + (r * (b - a))
a + (b-a) * Math.random();
a + Math.random() * (b - a)
double pick(double a, double b){
return a + (Math.random() * (b-a));
}
Random random = new Random();
float value = (random.nextFloat() * (b - a)) + a;
Random random = new Random();
float value = random.nextFloat(a, b);
(+ a (random (float (- b a))))
function pick(a,b)
return a + (math.random()*(b-a))
end
float pick(float a,float b) {
id<GKRandom> rnd=GKMersenneTwisterRandomSource.sharedRandom;
float ru;
while ((ru=rnd.nextUniform)==1);
return a+ru*(b-a);
}
function pick(float $a, float $b): float
{
$rand = mt_rand() / mt_getrandmax();
$rand *= ($b - $a);
$rand += ($a);
return $rand;
}
function pick(a, b:real): real;
begin
result := a + random * (b - a);
end;
my ($min, $max) = (1.5, 7.2);
my $x = $min + rand($max-$min);
thread_rng().gen_range(a..b);
def randomDraw(min: Double, max: Double): Double = {
val range = max - min
(random.doubleValue * range) + min
}
(+ a (* (- b a) (random 1.0)))
| rand |
rand := Random new.
rand next * (b - a) + a
Function pick(a As Double, b As Double) As Double
Static rng As New Random()
Return rng.NextDouble() * (b - a) + a
End Function