Fandom

Petit Computer Wiki

RND (Function)

915pages on
this wiki
Add New Page
Comments0 Share

V1Edit

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

V2Edit

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).

V3Edit

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

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.