Jump to content

Pseudo-random numbers/Splitmix64: Difference between revisions

m
Sigh. Spell algorithm name correctly in task header
(→‎{{header|Go}}: Removed preamble as all well now.)
m (Sigh. Spell algorithm name correctly in task header)
Line 1:
{{draft task|PRNG}}
 
Shiftmix64Splitmix64 is the default pseudo-random number generator algorithm in Java and is included / available in many other languages. It uses a fairly simple algorithm that, though it is considered to be poor for cryptographic purposes, is very fast to calculate, and is "good enough" for many random number needs. It passes several fairly rigorous PRNG "fitness" tests that some more complex algorithms fail.
 
Shiftmix64Splitmix64 is not recommended for demanding random number requirements, but is often used to calculate initial states for other more complex pseudo-random number generators.
 
The "standard" shiftmix64splitmix64 maintains one 64 bit state variable and returns 64 bits of random data with each call.
 
Basic pseudocode algorithm:
Line 30:
; Task:
 
* Write a class or set of functions that generates pseudo-random numbers using shiftmix64splitmix64.
 
* Show the first five integers generated using the seed 1234567.
10,333

edits

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