Replace Math.random() with a proper Random Number Generator

Author: th-s-opCreated Jan 11, 2026Updated Jan 11, 2026

Right now the project generates a random “No” using Math.random().

As this "No as a Service" will lead to world wide important decisions with possible impact on peace and human life, one can not be too serious about randomness.

The JS/ECMAScript spec does not require Math.random() to be secure, and engines are free to implement it however they want. That means it can be predictable enough for someone to bias outcomes or replay patterns.

So to be guaranteed unpredictable, fair, harder to reason about across environments and future-proof, I recommend the use of a cryptographically safe random number generator. Consider implementing it as a "ultra-serious mode" using a header like "X-No-As-A-Service-RNG: csprng" so we can proudly claim "Our No is cryptographically strong."

Source: hotheadhacker/no-as-a-service