ManiaMap.Godot
Procedural generation of metroidvania style maps for Godot .NET.
Rand.cs
1using MPewsey.Common.Random;
2using System;
3
5{
9 public static class Rand
10 {
11 public static Random Random { get; } = new Random();
12
18 public static int AutoAssignId(int id)
19 {
20 return id <= 0 ? GetRandomId() : id;
21 }
22
26 public static int GetRandomId()
27 {
28 return Random.Next(1, int.MaxValue);
29 }
30
36 public static RandomSeed CreateRandomSeed(int seed)
37 {
38 return new RandomSeed(seed <= 0 ? Random.Next(1, int.MaxValue) : seed);
39 }
40 }
41}
Contains the random number generator used for ID and random seed assignments.
Definition: Rand.cs:10
static int GetRandomId()
Returns a random positive integer ID.
Definition: Rand.cs:26
static RandomSeed CreateRandomSeed(int seed)
Returns a new RandomSeed object for the given seed. If the specified seed is less than or equal to ze...
Definition: Rand.cs:36
static int AutoAssignId(int id)
If the specified ID is less than or equal to zero, returns a new random positive integer ID....
Definition: Rand.cs:18