Graph
Xorshift

🎲Xorshift

NEW

A family of fast pseudorandom number generators using XOR and shift operations.

DESCRIPTION

Xorshift PRNGs use simple bitwise XOR and shift operations to produce sequences of pseudorandom numbers. They have small state and high speed, making them suitable for simulations and games. However, they are not cryptographically secure and can exhibit statistical weaknesses if poorly parameterized. Variants like xorshift* and xoroshiro improve equidistribution and quality.

ALTERNATIVE DEFINITIONS

Wikipedia

Xorshift is a class of pseudorandom number generators that uses a sequence of XOR and shift operations to generate random numbers.

Defines algorithmic core succinctly with class characterization.

Source

Journal of Statistical Software

Xorshift RNGs are extremely fast and use sequences of xors and shifts; they produce long periods but are not suited for cryptography.

Highlights speed, period, and non-cryptographic nature.

Source

Pseudorandom Number Generator Linear Congruential Generator Seed Period Entropy Binary XOR Bitwise Operation Philox

COMPETING TERMS

Mersenne Twister Permuted Congruential Generator

KNOWLEDGE AREAS

Mathematics Software Engineering Data Science

TARGET AUDIENCE

Software Developer Data Scientist AI Engineer

EXTERNAL SOURCES

TOP QUESTIONS

It is extremely fast and easy to implement, making it useful for simulations, games, and randomized algorithms where cryptographic security is unnecessary.

Category: Relevancy

What is the biggest misunderstanding about Xorshift?

People mistake it as cryptographically secure. It is not suitable for security-sensitive applications.

Category: Misunderstanding

How do you choose parameters for Xorshift?

Use published parameter sets with proven properties or well-known variants like xorshift* and xoroshiro for improved quality.

Category: Requirements

What are competing PRNGs to Xorshift?

Mersenne Twister offers longer period but slower speed; PCG provides better statistical properties with simplicity.

Category: Alternatives

What is the risk of poor seeding in Xorshift?

Correlated sequences or short cycles can occur. Seed properly and avoid zero states.

Category: Risks

How is Xorshift tested for randomness?

Run statistical test suites (e.g., TestU01, Dieharder) and analyze distribution, autocorrelation, and spectral properties.

Category: Testing

How does Xorshift compare to LCGs?

Xorshift typically has better distribution and speed than naive LCGs, with simple implementation.

Category: Distinction

Where to learn more about Xorshift?

Read Marsaglia’s paper and explore modern variants from Vigna and Blackman with reference implementations.

Category: Requirements

How does XORWOW relate to Xorshift?

XORWOW is an extended xorshift variant used in cuRAND, balancing speed and quality.

Category: Example