Class RandomDataGenerator
- Namespace
- ScottPlot
- Assembly
- ScottPlot.dll
public class RandomDataGenerator
- Inheritance
-
RandomDataGenerator
- Inherited Members
- Extension Methods
Constructors
RandomDataGenerator(int?)
Create a random number generator. The seed is random by default, but could be fixed to the defined value
public RandomDataGenerator(int? seed = null)
Parameters
seed
int?
Properties
Generate
public static RandomDataGenerator Generate { get; }
Property Value
Methods
AddNoise(double[], double)
Return a copy of the given data with random noise added (± magnitude)
public double[] AddNoise(double[] input, double magnitude)
Parameters
Returns
- double[]
AddNoiseInPlace(double[], double)
Mutate the given array by adding noise (± magnitude) and return it
public void AddNoiseInPlace(double[] values, double magnitude)
Parameters
RandomByte()
Return a random byte (0-255)
public byte RandomByte()
Returns
RandomByte(byte, byte)
Return a random byte between the given values (inclusive)
public byte RandomByte(byte min, byte max)
Parameters
Returns
RandomInteger()
Return a random integer up to the maximum integer size
public int RandomInteger()
Returns
RandomInteger(int)
Return a random integer between zero (inclusive) and max
(exclusive)
public int RandomInteger(int max)
Parameters
max
int
Returns
RandomInteger(int, int)
Return a random integer between min
(inclusive) and max
(exclusive)
public int RandomInteger(int min, int max)
Parameters
Returns
RandomNonZeroNumber(double)
Return a random number guaranteed not to be zero
public double RandomNonZeroNumber(double max = 1)
Parameters
max
double
Returns
RandomNormalNumber(double, double)
Return a number normally distributed around the given mean
according to the stdDev
standard deviation.
public double RandomNormalNumber(double mean = 0, double stdDev = 1)
Parameters
Returns
RandomNormalSample(int, double, double)
Return a collection of numbers normally distributed around the given mean
according to the stdDev
standard deviation.
public double[] RandomNormalSample(int count, double mean = 0, double stdDev = 1)
Parameters
Returns
- double[]
RandomNumber()
Return a uniformly random number between 0 (inclusive) and 1 (exclusive)
public double RandomNumber()
Returns
RandomNumber(double)
Return a uniformly random number between 0 (inclusive) and max
(exclusive)
public double RandomNumber(double max)
Parameters
max
double
Returns
RandomNumber(double, double)
Return a uniformly random number between min
(inclusive) and max
(exclusive)
public double RandomNumber(double min, double max)
Parameters
Returns
RandomOHLCs(int)
Return a collection OHLCs representing random price action
public List<OHLC> RandomOHLCs(int count)
Parameters
count
int
Returns
RandomOHLCs(int, DateTime)
Return a collection OHLCs representing random price action
public List<OHLC> RandomOHLCs(int count, DateTime start)
Parameters
Returns
RandomSample(int, double, double)
Uniformly distributed random numbers between 0 and 1
(multiplied by mult
then added to offset
).
public double[] RandomSample(int count, double mult = 1, double offset = 0)
Parameters
Returns
- double[]
RandomSin(int)
Sine wave with random frequency, amplitude, and phase
public double[] RandomSin(int count)
Parameters
count
int
Returns
- double[]
RandomWalk(int, double, double, double)
A sequence of numbers that starts at offset
and "walks" randomly from one point to the next, scaled by mult
with an approximate slope of slope
.
public double[] RandomWalk(int count, double mult = 1, double offset = 0, double slope = 0)
Parameters
Returns
- double[]
Seed(int)
public void Seed(int seed)
Parameters
seed
int