Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/HeuristicLab.ExtLibs/HeuristicLab.SimSharp/3.3.2/SimSharp-3.3.2/Random/SystemRandom.cs

Last change on this file was 18023, checked in by jkarder, 3 years ago

#3065: update Sim# to 3.3.2

File size: 846 bytes
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
8using System;
9
10namespace SimSharp {
11  public class SystemRandom : IRandom {
12    private Random random;
13
14    public SystemRandom() {
15      random = new Random();
16    }
17
18    public SystemRandom(int seed) {
19      random = new Random(seed);
20    }
21    public int Next() {
22      return random.Next();
23    }
24
25    public int Next(int upperBound) {
26      return random.Next(upperBound);
27    }
28
29    public int Next(int lowerBound, int upperBound) {
30      return random.Next(lowerBound, upperBound);
31    }
32
33    public double NextDouble() {
34      return random.NextDouble();
35    }
36
37    public void Reinitialise(int seed) {
38      random = new Random(seed);
39    }
40  }
41}
Note: See TracBrowser for help on using the repository browser.