Subtractive generator: Difference between revisions
Dialects of BASIC moved to the BASIC section.
(RPL: add section) |
(Dialects of BASIC moved to the BASIC section.) |
||
Line 187:
229: 380969305</pre>
=={{header|
==={{header|BBC BASIC}}===
{{works with|BBC BASIC for Windows}}
<syntaxhighlight lang="bbcbasic"> dummy% = FNsubrand(292929)
Line 227 ⟶ 228:
506003769
380969305
</pre>
==={{header|uBasic/4tH}}===
<syntaxhighlight lang="text">Push 292929 : Gosub 100 : d = Pop()
For i = 1 To 10
Push 0 : Gosub 100
Print Pop()
Next
End
100 s = Pop()
If s = 0 Then
p = (p + 1) % 55
@(p) = @(p) - @((p + 31) % 55)
If @(p) < 0 Then
@(p) = @(p) + 1000000000
Endif
Push (@(p)) : Return
Endif
@(54) = s : @(33) = 1
p = 12
For i = 2 To 54
@(p) = @((p + 42) % 55) - @((p + 21) % 55)
If @(p) < 0 Then
@(p) = @(p) + 1000000000
Endif
p = (p + 34) % 55
Next
For i = 55 To 219
Push 0 : Gosub 100 : d = Pop()
Next
Push 0 : Return</syntaxhighlight>
{{out}}
<pre>467478574
512932792
539453717
20349702
615542081
378707948
933204586
824858649
506003769
380969305
0 OK, 0:864
</pre>
Line 2,180 ⟶ 2,232:
puts [subrand::gen]
}</syntaxhighlight>
=={{header|Wren}}==
|