UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software UniBasic Commands Reference - Rocket Software

rocketsoftware.com
from rocketsoftware.com More from this publisher
11.04.2013 Views

RNDSEED Syntax RNDSEED expr Description The UniBasic RNDSEED command enables you to “seed” the pseudo random number generator. The RND function gives you a different sequence of numbers each time. RNDSEED generates the same sequence of random numbers each time you run a program with the same seed. expr is a numeric seed point. Each time you use the same expr, RND generates the same sequence of random numbers. Example In the following program segment, RND produces an array of random numbers to replace the values in VCOST. Because RNDSEEN is a constant, this program always produces the same series of random numbers. Without this statement, the program produces a different set of random numbers each time it is run. 1-694 UniBasic Commands Reference RNDSEED 234 VCOST = 100:@VM:200:@VM:0@VM:100:@VM:200:@VM:300 VCOST = RND(VCOST) PRINT VCOST Related Command UniBasic RND

RQM RQM is a synonym for the SLEEP function. For more information, see SLEEP. Synonym SLEEP RQM 1-695

RNDSEED<br />

Syntax<br />

RNDSEED expr<br />

Description<br />

The <strong>UniBasic</strong> RNDSEED command enables you to “seed” the pseudo random<br />

number generator. The RND function gives you a different sequence of numbers each<br />

time. RNDSEED generates the same sequence of random numbers each time you run<br />

a program with the same seed.<br />

expr is a numeric seed point. Each time you use the same expr, RND generates the<br />

same sequence of random numbers.<br />

Example<br />

In the following program segment, RND produces an array of random numbers to<br />

replace the values in VCOST. Because RNDSEEN is a constant, this program always<br />

produces the same series of random numbers. Without this statement, the program<br />

produces a different set of random numbers each time it is run.<br />

1-694 <strong>UniBasic</strong> <strong>Commands</strong> <strong>Reference</strong><br />

RNDSEED 234<br />

VCOST = 100:@VM:200:@VM:0@VM:100:@VM:200:@VM:300<br />

VCOST = RND(VCOST)<br />

PRINT VCOST<br />

Related Command<br />

<strong>UniBasic</strong><br />

RND

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!