57 static std::atomic<int64> globalSeed { 0 };
78 return (
int) (
seed >> 16);
89 return range.getStart() +
nextInt (range.getLength());
99 return (
nextInt() & 0x40000000) != 0;
105 / (
static_cast<float> (std::numeric_limits<uint32>::max()) + 1.0f);
106 return result == 1.0f ? 1.0f - std::numeric_limits<float>::epsilon() :
result;
111 return static_cast<uint32> (
nextInt()) / (std::numeric_limits<uint32>::max() + 1.0);
122 while (
n >= maximumValue);
129 int*
d =
static_cast<int*
> (buffer);
131 for (; bytes >=
sizeof (
int); bytes -=
sizeof (
int))
136 const int lastBytes =
nextInt();
143 arrayToChange.
setBit (startBit + numBits - 1,
true);
145 while ((startBit & 31) != 0 && numBits > 0)
151 while (numBits >= 32)
158 while (--numBits >= 0)
174 void runTest()
override
176 beginTest (
"Random");
178 Random
r = getRandom();
180 for (
int i = 2000; --
i >= 0;)
182 expect (
r.nextDouble() >= 0.0 &&
r.nextDouble() < 1.0);
183 expect (
r.nextFloat() >= 0.0f &&
r.nextFloat() < 1.0f);
184 expect (
r.nextInt (5) >= 0 &&
r.nextInt (5) < 5);
185 expect (
r.nextInt (1) == 0);
187 int n =
r.nextInt (50) + 1;
188 expect (
r.nextInt (
n) >= 0 &&
r.nextInt (
n) <
n);
190 n =
r.nextInt (0x7ffffffe) + 1;
191 expect (
r.nextInt (
n) >= 0 &&
r.nextInt (
n) <
n);
196static RandomTests randomTests;
#define noexcept
Definition DistrhoDefines.h:72
Definition juce_BigInteger.h:39
int getHighestBit() const noexcept
Definition juce_BigInteger.cpp:376
void setBit(int bitNumber)
Definition juce_BigInteger.cpp:288
void setBitRangeAsInt(int startBit, int numBits, uint32 valueToSet)
Definition juce_BigInteger.cpp:261
float nextFloat() noexcept
Definition juce_Random.cpp:102
int64 seed
Definition juce_Random.h:129
void fillBitsRandomly(void *bufferToFill, size_t sizeInBytes)
Definition juce_Random.cpp:127
bool nextBool() noexcept
Definition juce_Random.cpp:97
void setSeedRandomly()
Definition juce_Random.cpp:55
void combineSeed(int64 seedValue) noexcept
Definition juce_Random.cpp:50
int nextInt() noexcept
Definition juce_Random.cpp:74
int64 nextInt64() noexcept
Definition juce_Random.cpp:92
void setSeed(int64 newSeed) noexcept
Definition juce_Random.cpp:35
double nextDouble() noexcept
Definition juce_Random.cpp:109
BigInteger nextLargeNumber(const BigInteger &maximumValue)
Definition juce_Random.cpp:114
Random(int64 seedValue) noexcept
Definition juce_Random.cpp:26
static Random & getSystemRandom() noexcept
Definition juce_Random.cpp:67
Definition juce_Range.h:40
static int64 currentTimeMillis() noexcept
Definition juce_Time.cpp:220
static int64 getHighResolutionTicksPerSecond() noexcept
Definition juce_linux_SystemStats.cpp:329
static int64 getHighResolutionTicks() noexcept
Definition juce_linux_SystemStats.cpp:313
static uint32 getMillisecondCounter() noexcept
Definition juce_Time.cpp:241
Definition juce_UnitTest.h:70
unsigned d
Definition inflate.c:940
register unsigned i
Definition inflate.c:1575
Definition juce_UnitTestCategories.h:27
Definition carla_juce.cpp:31
unsigned long long uint64
Definition juce_MathsFunctions.h:56
unsigned int uint32
Definition juce_MathsFunctions.h:45
long long int64
Definition juce_MathsFunctions.h:54
int pointer_sized_int
Definition juce_MathsFunctions.h:80
int n
Definition crypt.c:458
memcpy(hh, h, RAND_HEAD_LEN)
int r
Definition crypt.c:458
int result
Definition process.c:1455
typedef int(UZ_EXP MsgFn)()