Old pseudo random number generator
This is an old pseudo random number generator in basic language in the book:
Tandy/Radio Shack Book:: Basic Software Library - Volume 2 (1976)(Scientific Research Inst)
page 389
https://archive.org/details/Basic_So..._Research_Inst
all the 8 volumes can be downloaded free here:
https://archive.org/details/tandy_bo...e+Library&sin=
how to run these GWBASIC codes:
download pc-basic from: https://robhagemans.github.io/pcbasic/ a good gwbasic emulator
the program save and load basic files from C:\Users\YourUserName in windows 7. but in winxp it is in the installation folder
the random.bas code: note that ** in the book is replaced by ^
Code:
10 REM generates random #'s 0< x <1
20 LET A=4
30 LET A=A/3
50 LET B=(A+R)^8
60 LET R=B-INT(B)
70 LET I=I+1
80 IF I>100 THEN 110
90 PRINT R;
100 GOTO 50
110 LET I=0
120 END
save it to C:\Users\YourUserName in windows 7, the run the pc-basic and load it Load "random.bas"
then Run
here is one possible conversion to thinbasic
Code:
Uses "Console"
'generates random #'s 0< x <1
Dim A,B,R As Single
Dim i As Long
A=4
A=A/3
While i<100
B=(A+R)^8
R=B-Int(B)
I=I+1
PrintL Str$(R)+" "
Wend
WaitKey
this is just a showcase but there are too many goodies written for GWBasic over the time from games to math to astronomy... etc and we can use it in the modern Basic languages easily