NoiseEngine/CubicNoise/Noisers/RandomNumberEngine.cs

33 lines
876 B
C#
Raw Normal View History

2020-01-11 18:00:46 +00:00
using System;
using System.Collections.Generic;
using System.Text;
using CubicNoise.Contracts;
namespace CubicNoise.Noisers
{
2020-01-11 23:32:10 +00:00
/// <summary>
/// This is the random number engine which gets used in case that the UNKNOWN type was used.
/// This engine is not meant for production. It is a placeholder for empty values, where a type
/// is needed. The engine will generate a random value each time.
/// </summary>
internal sealed class RandomNumberEngine : INoiseEngine
2020-01-11 18:00:46 +00:00
{
2020-01-11 23:32:10 +00:00
private readonly Random rng;
2020-01-11 18:00:46 +00:00
2020-01-11 23:32:10 +00:00
internal RandomNumberEngine(int seed)
2020-01-11 18:00:46 +00:00
{
this.rng = new Random(seed);
}
public float Get(float x)
{
return this.rng.Next();
}
public float Get(float x, float y)
{
return this.rng.Next();
}
}
}