Jump to content

Pseudo-random numbers/Middle-square method: Difference between revisions

Added Forth entry
(Added Sidef)
(Added Forth entry)
Line 279:
432883
</pre>
 
=={{header|Forth}}==
{{works with|gforth|0.7.3}}
The loop keeps the seed on top of the stack.
<lang forth>: next-random dup * 1000 / 1000000 mod ;
: 5-random-num 5 0 do next-random dup . loop ;
675248 5-random-num</lang>
 
{{out}}
<pre>959861 333139 981593 524817 432883 ok</pre>
 
 
=={{header|FreeBASIC}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.