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

Content added Content deleted
Line 679: Line 679:
{{trans|C}}
{{trans|C}}
<syntaxhighlight lang="Scheme">
<syntaxhighlight lang="Scheme">
{{def randoms
{def randoms
{lambda {:s :n}
{lambda {:s :n}
{if {>= :n 0}
{if {>= :n 0}
then :s
then :s
{randoms {floor {% {/ {* :s :s} 1.e3} 1.e6}}
{randoms {W.pad {% {floor {/ {* :s :s} 1.e3}} 1.e6} 6}
{- :n 1}}
{- :n 1}}
else}}}
else}}}
Line 689: Line 689:


{randoms 675248 100}
{randoms 675248 100}
->
-> 675248 959861 333139 981593 524817 432883 387691 304311 605184 247673 341914 905183 356263 923325 529055 899193 548051 359898 526570 275964 156129 376264 574597 161712 150770 731592 226854 462737 125531 758031 610996 316112 926796 950825 68180 648512 567814 412738 352656 366254 141992 161728 155945 318843 660858 733296 723023 762258 37258 388158 666632 398223 581557 208544 490599 687378 488514 645928 222981 720526 157716 874336 463440 776633 158816 222521 515595 838204 585945 331543 920760 798977 364246 675148 824821 329682 690221 405028 47680 273382 737717 226372 244282 673695 864953 143692 647390 113812 953171 534955 176852 276629 523603 160101 632330 841228 664547 622715 773971 31108 967707
675248 959861 333139 981593 524817 432883 387691 304311 605184 247673 341914 905183 356263 923325 529055 899193 548051 359898 526570 275964 156129 376264 574597 161712 150770 731592 226854 462737 125531 758031 610996 316112 926796 950825 681806 859421 604455 365847 844027 381576 600243 291659 649726 143875 700015 210006 102520 510350 457122 960522 602512 207106 892895 261481 372313 616969 650746 470356 234766 115074 242025 576100 891210 255264 159709 506964 124976 619000 161000 921000 241000 810006 109720 384786 602656 194254 734616 660667 480884 249421 210835 451397 759251 462081 518850 205322 157123 687637 844643 421797 912709 377186 269278 510641 754230 862892 582603 426255 693325 699555 377198
</syntaxhighlight>
</syntaxhighlight>