Class DFRandom
Reimplementing key parts of Daggerfall's random library. This ensures critical random number sequences (e.g. building names) will match Daggerfall's output across all platforms.
Namespace: DaggerfallWorkshop
Assembly: Assembly-CSharp.dll
Syntax
public static class DFRandom
Properties
| Improve this Doc View SourceSeed
Declaration
public static uint Seed { get; set; }
Property Value
Type | Description |
---|---|
UInt32 |
Methods
| Improve this Doc View Sourcerand()
Generate a random number.
Declaration
public static uint rand()
Returns
Type | Description |
---|---|
UInt32 |
random_range(Int32)
Generates a random number between 0 and max (exclusive).
Declaration
public static int random_range(int max)
Parameters
Type | Name | Description |
---|---|---|
Int32 | max | Maximum number (exclusive). |
Returns
Type | Description |
---|---|
Int32 | Random number between 0 and max - 1. |
random_range(Int32, Int32)
Generates a random number between min and max (exclusive).
Declaration
public static int random_range(int min, int max)
Parameters
Type | Name | Description |
---|---|---|
Int32 | min | Minimum number. |
Int32 | max | Maximum number (exclusive). |
Returns
Type | Description |
---|---|
Int32 | Random number between min and max - 1. |
random_range_inclusive(Int32, Int32)
Generates a random number between min and max (inclusive).
Declaration
public static int random_range_inclusive(int min, int max)
Parameters
Type | Name | Description |
---|---|---|
Int32 | min | Minimum number. |
Int32 | max | Maximum number (inclusive). |
Returns
Type | Description |
---|---|
Int32 | Random number between min and max - 1. |
RestoreSeed()
Declaration
public static void RestoreSeed()
SaveSeed()
Declaration
public static void SaveSeed()
srand(Int32)
Seed random generator.
Declaration
public static void srand(int seed)
Parameters
Type | Name | Description |
---|---|---|
Int32 | seed | Seed int. |
srand(UInt32)
Seed random generator.
Declaration
public static void srand(uint seed)
Parameters
Type | Name | Description |
---|---|---|
UInt32 | seed | Seed uint. |