Skip to content

Random Number Generator

Random Number Generator

This package handles random number generation different that the JavaScript package. This difference affects:

  • init()
  • setRNG()
  • getConfig()

Random Data CAN Be Captured

Capturing the random data used to generate shares is possible. It's not enabled by default and the function() necessary to process the random data is at the discretion users of this package.

The ability to access the random data is solely intended for random dithering (like the images below).

Image title

The secrets module is used for generating cryptographically strong random numbers suitable for managing data such as passwords, account authentication, security tokens, and related secrets.

The secrets module should be used instead of the default pseudo-random number generator in the random module, which is designed for modelling and simulation, not security or cryptography.

Image title

Warning

The pseudo-random generators in the random module should not be used for security purposes. For security or cryptographic uses, use the secrets module.

Image title

Do Not Use

For testing purposes only!

The testRandom function serves as useful tool for development, generating predictable values. However, when it comes to applications involving security or cryptography, it's crucial to employ a robust random number generator.