NetLogo Help: random

### random1.0

#### random number

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

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

If number is zero, the result is always 0 as well.

Note: In versions of NetLogo prior to version 2.0, this primitive reported a floating point number if given a non-integer input. This is no longer the case. If you want a floating point answer, you must now use random-float instead.

    show random 3
    ;; prints 0, 1,  or 2
    show random -3
    ;; prints 0, -1, or -2
    show random 3.5
    ;; prints 0, 1, 2, or 3

See also random-float.

Take me to the full NetLogo Dictionary