# Switch rand.DefaultPrng to Xoshiro256\+\+ \(\#9301\) · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/b4b90af4e0a9b15a940d836d275ac9dc50198217)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: b4b90af4e0a9b15a940d836d275ac9dc50198217

Requested commit: b4b90af4e0a9b15a940d836d275ac9dc50198217

Commit: b4b90af4e0a9b15a940d836d275ac9dc50198217

Tree: 44cb548fe91d52662d06c5a00f0dd75ebf71dd74

Author: Frank Denis

Committer: GitHub

## Message

```
Switch rand.DefaultPrng to Xoshiro256++ (#9301)

Xoroshiro128+ is the current default non-cryptographic random
number generator.

This algorithm was designed to generate floating-point numbers, by
only using the top 53 bits. Lower bits have a significant bias, that
contradicts the documented properties for `rand.DefaultPrng`. This
also has implications on everything using `Random.fill()`, including
the way we generate random floating-point numbers.

In addition, Xoroshiro128+ has known issues. See for example:
- https://lemire.me/blog/2017/08/22/cracking-random-number-generators-xoroshiro128/
- https://www.pcg-random.org/posts/xoroshiro-fails-truncated.html

Xoshiro256++ addresses these issues, while remaining very fast.
```

## Parents

- [1f0b77b3b88112ef458f62c23df72003c843e7cc](https://git.cafe/gitcafe/zig/commit/1f0b77b3b88112ef458f62c23df72003c843e7cc?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/b4b90af4e0a9b15a940d836d275ac9dc50198217?format=markdown)
