BCX Console Demonstration Program s95.bas

'***************************************************************************** 
' Demonstrates the pseudo-random number generator functions that BCX supports 
'***************************************************************************** 
' 
' RANDOMIZE takes any argument 
' 
'   TIMER   is a BCX function that returns the number of seconds since 
'           Windows started. 
' 
'    RND    takes no argument and always returns a floating point number 
'           in the range of 0 and 1 
'***************************************************************************** 

DIM i

RANDOMIZE(TIMER)

FOR i = 1 TO 20
  PRINT RND
NEXT

Result:

0.1282965
0.02418221
0.4997252
0.6380826
0.9706174
0.198756
0.9959664
0.1732732
0.4077337
0.240756
0.5193399
0.79604
0.5548509
0.3009924
0.4640974
0.5085299
0.7049273
0.8415984
0.4119758
0.3505276