Mostly used for testing, but also for deterministic values always returning the same sequence.
View code on GitHub
Inheritance Hierarchy
DeltaEngine.Core Randomizer
DeltaEngine.Core FixedRandom
Namespace: DeltaEngine.Core
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax
Constructors
Name | Description | |
---|---|---|
FixedRandom | Initializes a new instance of the FixedRandom class | |
FixedRandom( Single ) | Initializes a new instance of the FixedRandom class |
Methods
Name | Description | |
---|---|---|
Get(Int32, Int32) | (Overrides Randomizer Get(Int32, Int32).) | |
Get(Single, Single) | (Overrides Randomizer Get(Single, Single).) |
Remarks
Examples
[Test] public void Get() { var random = new FixedRandom(new[] { 0.1f, 0.2f });
[Test] public void GetWithNoFixedValuesAssigned() { var random = new FixedRandom(); Assert.AreEqual(-3, random.Get(-3, 5)); Assert.AreEqual(-7.1f, random.Get(-7.1f, -1.1f)); }
[Test] public void FixedValueOutOfRangeThrowsException() { Assert.Throws<FixedRandom.FixedValueOutOfRange>( () => new FixedRandom(new[] { 0.0f, 1.0f, 0.0f })); Assert.Throws<FixedRandom.FixedValueOutOfRange>(() => new FixedRandom(new[] { -0.01f })); }
See Also