Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/HeuristicLab.ExtLibs/HeuristicLab.SimSharp/3.3.1/SimSharp-3.3.1/Random/SystemRandom.cs @ 17487

Last change on this file since 17487 was 17487, checked in by abeham, 4 years ago

#3065: update Sim# to 3.3.1

File size: 887 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.