# C++'s Random Number Engines Are Not Cryptographically Secure

Original title: Everything should be a random number generator

> Hacker News story 50372396 · language: en · submitted 2026-11-04
> Web version: https://zeli.app/story/50372396
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 5 · by [efren6](<https://news.ycombinator.com/user?id=efren6>) · 💬 4
[original](<https://en.cppreference.com/cpp/numeric/random>) · [HN discussion](<https://news.ycombinator.com/item?id=50372396>)

## Summary

The C++ standard library splits random number generation into uniform random bit generators — engines like the linear congruential, Mersenne twister, subtract-with-carry, and the new Philox engine added in C++26 — and distributions that reshape their output into uniform, normal, Poisson, and other statistical forms. Engines can be seeded, serialized, and restored for repeatable simulations, but none of them are cryptographically secure; for that, the docs point to OpenSSL's RAND_bytes.

## Key quote

> None of these random number engines are cryptographically secure. As with any secure operation, a crypto library should be used for the purpose.

---

## Cite

- Page: https://zeli.app/story/50372396
- Date: 2026-11-04
- Source: en.cppreference.com (https://en.cppreference.com/cpp/numeric/random)
- Hacker News: https://news.ycombinator.com/item?id=50372396

## Other languages

- zh: https://zeli.app/zh/story/50372396 · markdown: https://zeli.app/zh/story/50372396.md
- ja: https://zeli.app/ja/story/50372396 · markdown: https://zeli.app/ja/story/50372396.md
- ko: https://zeli.app/ko/story/50372396 · markdown: https://zeli.app/ko/story/50372396.md
- de: https://zeli.app/de/story/50372396 · markdown: https://zeli.app/de/story/50372396.md
- es: https://zeli.app/es/story/50372396 · markdown: https://zeli.app/es/story/50372396.md
- ru: https://zeli.app/ru/story/50372396 · markdown: https://zeli.app/ru/story/50372396.md
