|
openshot-audio
0.1.5
|
#include <juce_Random.h>
Public Member Functions | |
| Random (int64 seedValue) noexcept | |
| Random () | |
| ~Random () noexcept | |
| int | nextInt () noexcept |
| int | nextInt (int maxValue) noexcept |
| int | nextInt (Range< int > range) noexcept |
| int64 | nextInt64 () noexcept |
| float | nextFloat () noexcept |
| double | nextDouble () noexcept |
| bool | nextBool () noexcept |
| BigInteger | nextLargeNumber (const BigInteger &maximumValue) |
| void | fillBitsRandomly (void *bufferToFill, size_t sizeInBytes) |
| void | fillBitsRandomly (BigInteger &arrayToChange, int startBit, int numBits) |
| void | setSeed (int64 newSeed) noexcept |
| int64 | getSeed () const noexcept |
| void | combineSeed (int64 seedValue) noexcept |
| void | setSeedRandomly () |
Static Public Member Functions | |
| static Random & | getSystemRandom () noexcept |
A random number generator.
You can create a Random object and use it to generate a sequence of random numbers.
|
explicitnoexcept |
Creates a Random object based on a seed value.
For a given seed value, the subsequent numbers generated by this object will be predictable, so a good idea is to set this value based on the time, e.g.
| Random::Random | ( | ) |
Creates a Random object using a random seed value. Internally, this calls setSeedRandomly() to randomise the seed.
|
noexcept |
Destructor.
|
noexcept |
Merges this object's seed with another value. This sets the seed to be a value created by combining the current seed and this new value.
| void Random::fillBitsRandomly | ( | void * | bufferToFill, |
| size_t | sizeInBytes | ||
| ) |
Fills a block of memory with random values.
| void Random::fillBitsRandomly | ( | BigInteger & | arrayToChange, |
| int | startBit, | ||
| int | numBits | ||
| ) |
Sets a range of bits in a BigInteger to random values.
|
inlinenoexcept |
Returns the RNG's current seed.
|
staticnoexcept |
The overhead of creating a new Random object is fairly small, but if you want to avoid it, you can call this method to get a global shared Random object.
It's not thread-safe though, so threads should use their own Random object, otherwise you run the risk of your random numbers becoming.. erm.. randomly corrupted..
|
noexcept |
Returns the next random boolean value.
|
noexcept |
Returns the next random floating-point number.
|
noexcept |
Returns the next random floating-point number.
|
noexcept |
Returns the next random 32 bit integer.
|
noexcept |
Returns the next random number, limited to a given range. The maxValue parameter may not be negative, or zero.
|
noexcept |
Returns the next random number, limited to a given range.
|
noexcept |
Returns the next 64-bit random number.
| BigInteger Random::nextLargeNumber | ( | const BigInteger & | maximumValue | ) |
Returns a BigInteger containing a random number.
| void Random::setSeedRandomly | ( | ) |
Reseeds this generator using a value generated from various semi-random system properties like the current time, etc.
Because this function convolves the time with the last seed value, calling it repeatedly will increase the randomness of the final result.
1.8.13