Be concise.
Be useful.
All contributions dictatorially edited by webmasters to match personal tastes.
Please do not paste any copyright violating material.
Please try to avoid dependencies to third-party libraries and frameworks.
(+ a (rand-int (- b a)))
a - 1 + :rand.uniform(b-a+1)
:crypto.rand_uniform(a, b)
crypto:rand_uniform(A, B)
real :: c
integer :: res
call random_number(c)
res = int((b-a+1)*c)
function pick(a, b) {
return a + Math.floor(Math.random() * (b - a + 1));
}
fun pick(a: Int, b: Int): Int {
return (a..b).random()
}
(defun r (a b)
(+ a (random (+ 1 (- b a )))))
math.random(a, b)
a+arc4random_uniform(b+1)
rand($a, $b)
my ($min, $max) = (5, 25);
my $val = $min + int(rand($max-$min));
rand(a..b)
(floor (+ a (* (add1 (- b a)) (random 1.0))))
(+ a (random (add1 (- b a))))
(a to: b) atRandom