QBasic 1.1: RANDOMIZE Statement

Syntax

RANDOMIZE [seed%]
RND[(n#)]

Description / Parameter(s)

seed% A number used to initialize the random-number generator. If omitted, RANDOMIZE prompts for it.
n# A value that sets how RND generates the next random number:
 
n#RND returns
Less than 0The same number for any n#
Greater than 0 (or omitted)The next random number
0The last number generated

Example

RANDOMIZE TIMER x% = INT(RND * 6) + 1 y% = INT(RND * 6) + 1 PRINT "Roll of two dice: die 1 ="; x%; "and die 2 ="; y%