Remote Processing CAMBASIC User Manual

Page 144

Advertising
background image

Comm ands - 111

RND

Numeric Fun ction

SYNTAX:

n = R N D (m)

PURPOSE:

To return a pseudo– random num ber between 0 and 1.

REMARK S:

The RND function returns a pseudo– random num ber between 0 and 1.

An m of less than zero will initialize the pseudo– random num ber sequence. Each time the
p s eu d o– r a n do m n um b e r g e ne r a to r is in it ia l iz e d w i th th e sa m e m nu m b er , i t w i ll pr o d uc e th e sa m e
sequence of pseudo– random number s.

An m of zero will cause RND to return the previous random number.

An m of greater than zero will cause RND to return the next random number in the sequence.

EXAMPLE:

10 R = RND(–1)
20 S = RND(0)
30 T = RND(1)
40 PRINT R,S,T
RUN
7.65943E–06 7.65943E–06 .163989

ERROR:

none

Advertising