LMMS
Loading...
Searching...
No Matches
Random.h
Go to the documentation of this file.
1/*
2 ==============================================================================
3
4 This file is part of the Water library.
5 Copyright (c) 2016 ROLI Ltd.
6 Copyright (C) 2017 Filipe Coelho <falktx@falktx.com>
7
8 Permission is granted to use this software under the terms of the ISC license
9 http://www.isc.org/downloads/software-support-policy/isc-license/
10
11 Permission to use, copy, modify, and/or distribute this software for any
12 purpose with or without fee is hereby granted, provided that the above
13 copyright notice and this permission notice appear in all copies.
14
15 THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD
16 TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
17 FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
18 OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
19 USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
20 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
21 OF THIS SOFTWARE.
22
23 ==============================================================================
24*/
25
26#ifndef WATER_RANDOM_H_INCLUDED
27#define WATER_RANDOM_H_INCLUDED
28
29#include "../water.h"
30
31namespace water {
32
33//==============================================================================
39class Random
40{
41public:
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 int64 nextInt64() noexcept;
76
80 float nextFloat() noexcept;
81
85 double nextDouble() noexcept;
86
88 bool nextBool() noexcept;
89
90 //==============================================================================
92 void setSeed (int64 newSeed) noexcept;
93
96
101 void combineSeed (int64 seedValue) noexcept;
102
109 void setSeedRandomly();
110
118
119private:
120 //==============================================================================
122};
123
124}
125
126#endif // WATER_RANDOM_H_INCLUDED
#define noexcept
Definition DistrhoDefines.h:72
Definition Random.h:40
void setSeedRandomly()
Definition Random.cpp:56
Random()
Definition Random.cpp:37
Random(int64 seedValue) noexcept
Definition Random.cpp:33
static Random & getSystemRandom() noexcept
Definition Random.cpp:66
double nextDouble() noexcept
Definition Random.cpp:101
void combineSeed(int64 seedValue) noexcept
Definition Random.cpp:51
int64 getSeed() const noexcept
Definition Random.h:95
int64 seed
Definition Random.h:121
float nextFloat() noexcept
Definition Random.cpp:96
int nextInt() noexcept
Definition Random.cpp:73
int64 nextInt64() noexcept
Definition Random.cpp:86
bool nextBool() noexcept
Definition Random.cpp:91
~Random() noexcept
Definition Random.cpp:42
void setSeed(int64 newSeed) noexcept
Definition Random.cpp:46
Definition AudioSampleBuffer.h:33
long long int64
Definition water.h:100
#define const
Definition zconf.h:137