random-float2.0

random-float number

If number is positive, reports a random floating point number greater than or equal to 0 but strictly less than number.

If number is negative, reports a random floating point number less than or equal to 0, but strictly greater than number.

If number is zero, the result is always 0.

show random-float 3
;; prints a number at least 0 but less than 3,
;; for example 2.589444906014774
show random-float 2.5
;; prints a number at least 0 but less than 2.5,
;; for example 1.0897423196760796

Take me to the full NetLogo Dictionary