Random numbers: Difference between revisions

m
→‎{{header|BASIC}}: QuickBASIC headered.
m (→‎{{header|BASIC}}: QuickBASIC headered.)
Line 158:
 
=={{header|BASIC}}==
{{works with|QuickBasic|4.5}}
RANDOMIZE TIMER 'seeds random number generator with the system time
pi = 3.141592653589793#
DIM a(1 TO 1000) AS DOUBLE
CLS
FOR i = 1 TO 1000
a(i) = 1 + SQR(-2 * LOG(RND)) * COS(2 * pi * RND)
NEXT i
 
==={{header|Applesoft BASIC}}===
The [[Random_numbers#Commodore_BASIC|Commodore BASIC]] code works in Applesoft BASIC.
Line 427 ⟶ 418:
a(i) = 1 + 0.5 * RandomNormal()
Next</syntaxhighlight>
 
==={{header|QuickBASIC}}===
{{works with|QuickBasic|4.5}}
<syntaxhighlight lang="qbasic">
RANDOMIZE TIMER 'seeds random number generator with the system time
pi = 3.141592653589793#
DIM a(1 TO 1000) AS DOUBLE
CLS
FOR i = 1 TO 1000
a(i) = 1 + SQR(-2 * LOG(RND)) * COS(2 * pi * RND)
NEXT i
</syntaxhighlight>
 
==={{header|Run BASIC}}===
511

edits