openshot-audio  0.1.7
juce_Random.h
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This file is part of the juce_core module of the JUCE library.
5  Copyright (c) 2015 - ROLI Ltd.
6 
7  Permission to use, copy, modify, and/or distribute this software for any purpose with
8  or without fee is hereby granted, provided that the above copyright notice and this
9  permission notice appear in all copies.
10 
11  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
12  TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
13  NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
15  IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 
18  ------------------------------------------------------------------------------
19 
20  NOTE! This permissive ISC license applies ONLY to files within the juce_core module!
21  All other JUCE modules are covered by a dual GPL/commercial license, so if you are
22  using any other modules, be sure to check that you also comply with their license.
23 
24  For more details, visit www.juce.com
25 
26  ==============================================================================
27 */
28 
29 #ifndef JUCE_RANDOM_H_INCLUDED
30 #define JUCE_RANDOM_H_INCLUDED
31 
32 
33 //==============================================================================
40 {
41 public:
42  //==============================================================================
51  explicit Random (int64 seedValue) noexcept;
52 
56  Random();
57 
59  ~Random() noexcept;
60 
64  int nextInt() noexcept;
65 
70  int nextInt (int maxValue) noexcept;
71 
75  int nextInt (Range<int> range) noexcept;
76 
80  int64 nextInt64() noexcept;
81 
85  float nextFloat() noexcept;
86 
90  double nextDouble() noexcept;
91 
93  bool nextBool() noexcept;
94 
98  BigInteger nextLargeNumber (const BigInteger& maximumValue);
99 
101  void fillBitsRandomly (void* bufferToFill, size_t sizeInBytes);
102 
104  void fillBitsRandomly (BigInteger& arrayToChange, int startBit, int numBits);
105 
106  //==============================================================================
108  void setSeed (int64 newSeed) noexcept;
109 
111  int64 getSeed() const noexcept { return seed; }
112 
117  void combineSeed (int64 seedValue) noexcept;
118 
125  void setSeedRandomly();
126 
133  static Random& getSystemRandom() noexcept;
134 
135 private:
136  //==============================================================================
137  int64 seed;
138 
140 };
141 
142 
143 #endif // JUCE_RANDOM_H_INCLUDED
Definition: juce_BigInteger.h:43
#define noexcept
Definition: juce_CompilerSupport.h:141
int64 getSeed() const noexcept
Definition: juce_Random.h:111
Definition: juce_Range.h:44
#define JUCE_API
Definition: juce_StandardHeader.h:139
#define const
Definition: juce_Random.h:39
long long int64
Definition: juce_MathsFunctions.h:60
#define JUCE_LEAK_DETECTOR(OwnerClass)
Definition: juce_LeakedObjectDetector.h:141