// VALUE Return a Float 0 - 1 public float Value(Normalization n, float t) { if (n == Normalization.STDNORMAL) { return((float)NormalDistribution.Normalize(_rand.NextSingle(true), t)); } else if (n == Normalization.POWERLAW) { return((float)PowerLaw.Normalize(_rand.NextSingle(true), t, 0, 1)); } else { return(_rand.NextSingle(true)); } }
// RANDOM RAINBOW COLOR public Color Rainbow(Normalization n, float t) { if (n == Normalization.STDNORMAL) { return(WaveToRgb.LinearToRgb((float)NormalDistribution.Normalize(_rand.NextSingle(true), t))); } else if (n == Normalization.POWERLAW) { return(WaveToRgb.LinearToRgb((float)PowerLaw.Normalize(_rand.NextSingle(true), t, 0, 1))); } else { return(WaveToRgb.LinearToRgb(_rand.NextSingle(true))); } }
// RANGE Return a Float min < x < max public float Range(Int32 minValue, Int32 maxValue, Normalization n, float t) { if (n == Normalization.STDNORMAL) { return(SpecialFunctions.ScaleFloatToRange((float)NormalDistribution.Normalize(_rand.NextSingle(true), t), minValue, maxValue, 0, 1)); } else if (n == Normalization.POWERLAW) { return((float)PowerLaw.Normalize(_rand.NextSingle(true), t, minValue, maxValue)); } else { return(_rand.Next(minValue, maxValue)); } }
/// <summary> /// Returns the next pseudo-random number integer between <paramref name="min"/> [inclusive] and <paramref name="max"/> [inclusive]. /// in Power Law distribution /// </summary> /// <param name="min">Minimum.</param> /// <param name="max">Maximum.</param> /// <param name="temperature">Temperature.</param> public float RangePower(float min, float max, float temperature) { return(ScaleFloatToRange((float)PowerLaw.Normalize(_rand.NextSingle(true), temperature, 0, 1), min, max, 0.0f, 1.0f)); }
/// <summary> /// Returns a power-law pseudo-random number between 0.0 [inclusive] and 1.0 [inclusive] (Read Only). /// </summary> /// <returns> /// This method returns a single-precision pseudo-random number greater than or equal to zero, and less /// than or equal to one. /// </returns> /// <param name="temperature">Temperature.</param> public float valuePower(float temperature) { return((float)PowerLaw.Normalize(_rand.NextSingle(true), temperature, 0, 1)); }