Loading...
Searching...
No Matches
juce_Random.h
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2022 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
The code included in this file is provided under the terms of the ISC license
http://www.isc.org/downloads/software-support-policy/isc-license. Permission
To use, copy, modify, and/or distribute this software for any purpose with or
without fee is hereby granted provided that the above copyright notice and
this permission notice appear in all copies.
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
namespace juce
{
//==============================================================================
class JUCE_API Random final
{
public:
//==============================================================================
explicit Random (int64 seedValue) noexcept;
Random();
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 { return seed; }
void combineSeed (int64 seedValue) noexcept;
void setSeedRandomly();
static Random& getSystemRandom() noexcept;
private:
//==============================================================================
int64 seed;
JUCE_LEAK_DETECTOR (Random)
};
} // namespace juce
juce::BigInteger
Definition juce_BigInteger.h:39
juce::Random
Definition juce_Random.h:35
juce::Random::nextFloat
float nextFloat() noexcept
Definition juce_Random.cpp:102
juce::Random::fillBitsRandomly
void fillBitsRandomly(void *bufferToFill, size_t sizeInBytes)
Definition juce_Random.cpp:127
juce::Random::nextBool
bool nextBool() noexcept
Definition juce_Random.cpp:97
juce::Random::nextInt
int nextInt() noexcept
Definition juce_Random.cpp:74
juce::Random::nextInt64
int64 nextInt64() noexcept
Definition juce_Random.cpp:92
juce::Random::getSeed
int64 getSeed() const noexcept
Definition juce_Random.h:103
juce::Random::setSeed
void setSeed(int64 newSeed) noexcept
Definition juce_Random.cpp:35
juce::Random::nextDouble
double nextDouble() noexcept
Definition juce_Random.cpp:109
juce::Random::nextLargeNumber
BigInteger nextLargeNumber(const BigInteger &maximumValue)
Definition juce_Random.cpp:114
juce::Random::Random
Random(int64 seedValue) noexcept
Definition juce_Random.cpp:26
juce::Range
Definition juce_Range.h:40