Jump to content

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

Replace Wikipedia link with template
(Add EasyLang)
(Replace Wikipedia link with template)
Line 1:
{{task}}
{{Wikipedia|Middle-square method|en}}
;[https://en.m.wikipedia.org/wiki/Middle-square_method Middle-square_method] Generator
; The Method:
To generate a sequence of n-digit pseudorandom numbers, an n-digit starting value is created and squared, producing a 2n-digit number. If the result has fewer than 2n digits, leading zeroes are added to compensate. The middle n digits of the result would be the next number in the sequence and returned as the result. This process is then repeated to generate more numbers.
175

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.