Petit Computer Wiki
Petit Computer Wiki
Advertisement

V1[]

Indications are, RND in SmileBasic V1 is identical to that in V2.

V2[]

Where A is a positive integer, RND(A) will return a random integer between 0 and A-1 inclusive. (In particular, RND(1) will always return 0.)

RND(0) will always return 0.

Where A is a negative integer, RND(A) will return a random integer between 0 and A+1 inclusive. (In particular, RND(-1) will always return 0.)

Where A is not an integer, it gets rounded down, then one of the rules above applies. (In particular, RND(-524287.99999) does not generate an overflow error. So, it is possible to get -524287 as a result, but it is not possible to get 524287.)

RND() generates Syntax error (RND).

RND("0") generates Type Mismatch (RND).

RND(2,6), oddly enough, generates Missing operand (RND).

V3[]

Indications are, RND in SmileBasic V3 is identical to that in V2.

Advertisement