FixedRandom ClassDelta Engine Documentation
Mostly used for testing, but also for deterministic values always returning the same sequence. View code on GitHub
Inheritance Hierarchy

System Object
  DeltaEngine.Core Randomizer
    DeltaEngine.Core FixedRandom

Namespace: DeltaEngine.Core
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public class FixedRandom : Randomizer
Constructors

  NameDescription
Public methodFixedRandom 
Initializes a new instance of the FixedRandom class
Public methodFixedRandom( Single )
Initializes a new instance of the FixedRandom class
Top
Methods

  NameDescription
Public methodGet(Int32, Int32) (Overrides Randomizer Get(Int32, Int32).)
Public methodGet(Single, Single) (Overrides Randomizer Get(Single, Single).)
Top
Remarks

Tests: DeltaEngine.Tests.Core.FixedRandomTests
Examples

3 unit tests call DeltaEngine.Core.FixedRandom
[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