[−][src]Module rug::rand
Random number generation.
This module provides two main structs.
RandStateis thread safe and can be shared and sent across threads.ThreadRandStateis suitable for use in a single thread.
RandState has constructors for Mersenne Twister and for linear
congruential random number generators. It can also be constructed
using a custom random number generator implementing the RandGen
trait, which has to implement Send and Sync too.
If you need a custom random number generator that cannot be shared or
sent across threads, you can use ThreadRandState instead.
ThreadRandState can be constructed using a custom random number
generator implementing the ThreadRandGen trait, which does not
have to implement Send or Sync.
Both RandState and ThreadRandState implement the
MutRandState trait so that they can be used with methods like
Integer::random_below.
Structs
| RandState | The state of a random number generator. |
| ThreadRandState | The state of a random number generator that is suitable for a single thread only. |
Traits
| MutRandState | Used to pass the state of random number generators by mutable reference. |
| RandGen | Custom random number generator to be used with |
| ThreadRandGen | Custom random number generator to be used with |