1 | using HeuristicLab.Persistence;
|
---|
2 | #region License Information
|
---|
3 | /* HeuristicLab
|
---|
4 | * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
5 | *
|
---|
6 | * This file is part of HeuristicLab.
|
---|
7 | *
|
---|
8 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
9 | * it under the terms of the GNU General Public License as published by
|
---|
10 | * the Free Software Foundation, either version 3 of the License, or
|
---|
11 | * (at your option) any later version.
|
---|
12 | *
|
---|
13 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
16 | * GNU General Public License for more details.
|
---|
17 | *
|
---|
18 | * You should have received a copy of the GNU General Public License
|
---|
19 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
20 | */
|
---|
21 | #endregion
|
---|
22 |
|
---|
23 | namespace HeuristicLab.Core {
|
---|
24 | /// <summary>
|
---|
25 | /// Represents an interface for random number generators.
|
---|
26 | /// </summary>
|
---|
27 | [StorableType("494faf35-0bdd-4565-a4c4-c86c0db09423")]
|
---|
28 | public interface IRandom : IItem {
|
---|
29 | /// <summary>
|
---|
30 | /// Resets the random number generator.
|
---|
31 | /// </summary>
|
---|
32 | void Reset();
|
---|
33 | /// <summary>
|
---|
34 | /// Resets the random number generator with the given <paramref name="seed"/>.
|
---|
35 | /// </summary>
|
---|
36 | /// <param name="seed">The new seed.</param>
|
---|
37 | void Reset(int seed);
|
---|
38 |
|
---|
39 | /// <summary>
|
---|
40 | /// Gets a new random number.
|
---|
41 | /// </summary>
|
---|
42 | /// <returns>A random integer number.</returns>
|
---|
43 | int Next();
|
---|
44 | /// <summary>
|
---|
45 | /// Gets a new random number between 0 and <paramref name="maxVal"/>.
|
---|
46 | /// </summary>
|
---|
47 | /// <param name="maxVal">The maximal value of the random number (exclusive).</param>
|
---|
48 | /// <returns>A random integer number smaller than <paramref name="maxVal"/>.</returns>
|
---|
49 | int Next(int maxVal);
|
---|
50 | /// <summary>
|
---|
51 | /// Gets a new random number between <paramref name="minVal"/> and <paramref name="maxVal"/>.
|
---|
52 | /// </summary>
|
---|
53 | /// <param name="maxVal">The maximal value of the random number (exclusive).</param>
|
---|
54 | /// <param name="minVal">The minimal value of the random number (inclusive).</param>
|
---|
55 | /// <returns>A random integer number. (<paramref name="minVal"/> <= x < <paramref name="maxVal"/>).</returns>
|
---|
56 | int Next(int minVal, int maxVal);
|
---|
57 | /// <summary>
|
---|
58 | /// Gets a new double random number.
|
---|
59 | /// </summary>
|
---|
60 | /// <returns>A random double number.</returns>
|
---|
61 | double NextDouble();
|
---|
62 | }
|
---|
63 | }
|
---|