Pseudo-random numbers/Xorshift star: Difference between revisions
Pseudo-random numbers/Xorshift star (view source)
Revision as of 03:32, 15 August 2020
, 3 years ago→{{header|Julia}}: no masking for 64 bit unsigneds
(→{{header|Go}}: Rely on implicit conversion from uint64 to uint32 rather than use a mask.) |
m (→{{header|Julia}}: no masking for 64 bit unsigneds) |
||
Line 218:
=={{header|Julia}}==
{{trans|Python}}
<lang julia>const
const CONST = 0x2545F4914F6CDD1D
mutable struct XorShiftStar
end
XorShiftStar(_seed=0x0) = XorShiftStar(UInt(_seed)
seed(x::XorShiftStar, num) = begin x.state = UInt64(num
"""return random int between 0 and 2**32"""
function next_int(x::XorShiftStar)
x.state =
x.state =
x.state =
return
end
|