Line | |
---|
1 | #region License Information |
---|
2 | /* |
---|
3 | * This file is part of SimSharp which is licensed under the MIT license. |
---|
4 | * See the LICENSE file in the project root for more information. |
---|
5 | */ |
---|
6 | #endregion |
---|
7 | |
---|
8 | namespace SimSharp { |
---|
9 | public class PcgRandom : IRandom { |
---|
10 | private Pcg pcg; |
---|
11 | |
---|
12 | public PcgRandom() { |
---|
13 | pcg = new Pcg(); |
---|
14 | } |
---|
15 | |
---|
16 | public PcgRandom(int seed) { |
---|
17 | pcg = new Pcg(seed); |
---|
18 | } |
---|
19 | public int Next() { |
---|
20 | return pcg.Next(); |
---|
21 | } |
---|
22 | |
---|
23 | public int Next(int upperBound) { |
---|
24 | return pcg.Next(upperBound); |
---|
25 | } |
---|
26 | |
---|
27 | public int Next(int lowerBound, int upperBound) { |
---|
28 | return pcg.Next(lowerBound, upperBound); |
---|
29 | } |
---|
30 | |
---|
31 | public double NextDouble() { |
---|
32 | return pcg.NextDouble(); |
---|
33 | } |
---|
34 | |
---|
35 | public void Reinitialise(int seed) { |
---|
36 | pcg = new Pcg(seed); |
---|
37 | } |
---|
38 | } |
---|
39 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.