Turtle and Observer Command

random number

Returns a random number between 0 and number, including 0 but not number, based on a uniform distribution.

Note: StarLogo uses the random generator provided by Java, which, as of now, is a linear congruential formula (Knuth Art of Computer Programming, Vol 2, Section 3.2.1.), which uses a 48-bit seed. StarLogo only allows you to set 32 bits of this seed.

Examples:

random 2 returns either 0 or 1, each with fifty percent probability.

Related commands: