John D. Cook 5/15/2026

Recovering the state of xorshift128

Read Original

This article details the process of recovering the internal state of the xorshift128 random number generator. It shows that by observing four consecutive outputs, the full state can be reconstructed, allowing prediction of future outputs. The post includes code examples in Python, compares xorshift128 to other generators like Mersenne Twister and PCG64, and discusses the trade-offs between speed, statistical quality, and cryptographic security. It emphasizes that while xorshift128 is fast and has good statistical properties, it is unsuitable for cryptography due to its predictability.

Recovering the state of xorshift128

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week

No top articles yet