Type IRandomizer
Namespace Karcero.Engine.Contracts
Contains several methods that fetch a value randomly.
Methods
Public instance methods
T GetRandomCell<T>(Map<T> map)
Get a random cell of any terrain from the map.
Parameters
-
Map<T>map - The map.
Returns
-
T - A random cell from the map.
double GetRandomDouble()
Get a random double.
Returns
-
double - A random double.
TItem GetRandomEnumValue<TItem>(IEnumerable<TItem> excluded)
Get a random value from the values of an enum.
Parameters
-
IEnumerable<TItem>excluded - Any values to be excluded from the enum's set of values.
Returns
-
TItem - A random value of TItem.
TItem GetRandomItem<TItem>(IEnumerable<TItem> collection)
Get a random value from a collection.
Parameters
-
IEnumerable<TItem>collection - The collection of values.
Returns
-
TItem - A random item from the collection.
Size GetRandomRoomSize(int minWidth, int maxWidth, int minHeight, int maxHeight)
Get a random room size within the measurements supplied.
Parameters
-
intminWidth - The min room width.
-
intmaxWidth - the max room width.
-
intminHeight - The min room height.
-
intmaxHeight - The max room height.
Returns
-
Size - A random room size within the measurements supplied.
void SetSeed(int seed)
The seed for any randomized operation. A random seed will be generated if one is not supplied.