mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-14 19:29:36 +01:00
Add IRobustRandom.SetSeed() (#4606)
This commit is contained in:
@@ -14,6 +14,7 @@ public interface IRobustRandom
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
System.Random GetRandom();
|
||||
void SetSeed(int seed);
|
||||
|
||||
float NextFloat();
|
||||
public float NextFloat(float minValue, float maxValue)
|
||||
|
||||
@@ -5,10 +5,15 @@ namespace Robust.Shared.Random
|
||||
{
|
||||
public sealed class RobustRandom : IRobustRandom
|
||||
{
|
||||
private readonly System.Random _random = new();
|
||||
private System.Random _random = new();
|
||||
|
||||
public System.Random GetRandom() => _random;
|
||||
|
||||
public void SetSeed(int seed)
|
||||
{
|
||||
_random = new(seed);
|
||||
}
|
||||
|
||||
public float NextFloat()
|
||||
{
|
||||
return _random.NextFloat();
|
||||
|
||||
Reference in New Issue
Block a user