PyTorch/CSPRNG 0.1.1 Release Notes
Features
torchcsprng exposes two methods to create crypto-secure and non-crypto-secure PRNGs:
| Method to create PRNG | Is crypto-secure? | Has seed? | Underlying implementation |
|----------------------------------------------------|-------------------|-----------|---------------------------|
| create_random_device_generator(token: string=None) | yes | no | See [std::random_device](https://en.cppreference.com/w/cpp/numeric/random/random_device) and [its constructor](https://en.cppreference.com/w/cpp/numeric/random/random_device/random_device). The implementation in libstdc++ expects token to name the source of random bytes. Possible token values include "default", "rand_s", "rdseed", "rdrand", "rdrnd", "/dev/urandom", "/dev/random", "mt19937", and integer string specifying the seed of the mt19937 engine. (Token values other than "default" are only valid for certain targets.) If token=None then constructs a new std::random_device object with an implementation-defined token. |
| create_mt19937_generator(seed: int=None) | no | yes | See [std::mt19937](https://en.cppreference.com/w/cpp/numeric/random/mersenne_twister_engine) and [its constructor](https://en.cppreference.com/w/cpp/numeric/random/mersenne_twister_engine/mersenne_twister_engine). Constructs a mersenne_twister_engine object, and initializes its internal state sequence to pseudo-random values. If seed=None then seeds the engine with default_seed.|
The following list of methods supports all forementioned PRNGs:
| Kernel | CUDA | CPU |
|------------------------|------|-----|
| random_() | yes | yes |
| random_(to) | yes | yes |
| random_(from, to) | yes | yes |
| uniform_(from, to) | yes | yes |
| normal_(mean, std) | yes | yes |
| cauchy_(median, sigma) | yes | yes |
| log_normal_(mean, std) | yes | yes |
| geometric_(p) | yes | yes |
| exponential_(lambda) | yes | yes |