Home

Xorshift

Xorshift is a family of pseudorandom number generators based on the repeated application of XOR and bitwise shift operations. Designed by George Marsaglia in 2003, xorshift generators are valued for their speed and simplicity on common CPUs, requiring only integer arithmetic and fast bitwise operators.

A typical xorshift generator maintains a small internal state, updates it with a fixed sequence of shifts

There are many parameterizations for 64-bit and larger states. The 128-bit version uses two 64-bit words to

Properties and limitations: xorshift generators are fast and simple, but their linear structure can introduce correlations

and
XORs,
and
uses
the
resulting
state
as
the
next
output.
A
widely
cited
32-bit
configuration
performs
three
operations
in
sequence:
x
^=
x
<<
13;
x
^=
x
>>
17;
x
^=
x
<<
5.
form
the
state
and
yields
a
long
period,
often
described
as
2^128
-
1
for
nonzero
seeds.
The
1024-bit
variant
uses
an
array
of
sixteen
64-bit
values,
with
a
recurrence
that
produces
a
period
of
2^1024
-
1.
Some
designs
include
an
output
scrambler,
such
as
a
multiplicative
step,
to
improve
statistical
properties
of
the
produced
numbers.
in
outputs
and
they
may
fail
certain
statistical
tests.
They
are
not
cryptographically
secure
and
should
not
be
used
where
strong
security
is
required.
They
are
commonly
employed
for
non-cryptographic
tasks
such
as
simulations
and
graphics,
and
are
sometimes
combined
with
additional
transforms
to
enhance
statistical
quality.