Пример #1
0
 /// <summary>
 /// Fill an array with samples from the distribution.
 /// </summary>
 /// <param name="buf">The array to fill with samples.</param>
 public void Sample(float[] buf)
 {
     for (int i = 0; i < buf.Length; i++)
     {
         buf[i] = (float)ZigguratGaussian.Sample(_rng, _mean, _stdDev);
     }
 }
Пример #2
0
 /// <summary>
 /// Fill an array with samples from the distribution, using the provided <see cref="IRandomSource"/> as the source of entropy.
 /// </summary>
 /// <param name="buf">The array to fill with samples.</param>
 public void Sample(IRandomSource rng, double[] buf)
 {
     for (int i = 0; i < buf.Length; i++)
     {
         buf[i] = (float)ZigguratGaussian.Sample(rng, _mean, _stdDev);
     }
 }
Пример #3
0
 /// <summary>
 /// Fill a span with samples from the distribution.
 /// </summary>
 /// <param name="span">The span to fill with samples.</param>
 public void Sample(Span <float> span)
 {
     for (int i = 0; i < span.Length; i++)
     {
         span[i] = ZigguratGaussian.Sample(_rng, _mean, _stdDev);
     }
 }
Пример #4
0
 /// <summary>
 /// Take a sample from the distribution.
 /// </summary>
 /// <returns>A random sample.</returns>
 public float Sample()
 {
     return((float)ZigguratGaussian.Sample(_rng, _mean, _stdDev));
 }
Пример #5
0
 /// <summary>
 /// Take a sample from the distribution, using the provided <see cref="IRandomSource"/> as the source of entropy.
 /// </summary>
 /// <returns>A random sample.</returns>
 public double Sample(IRandomSource rng)
 {
     return((float)ZigguratGaussian.Sample(rng, _mean, _stdDev));
 }
Пример #6
0
 /// <summary>
 /// Take a sample from the distribution, using the provided <see cref="IRandomSource"/> as the source of entropy.
 /// </summary>
 /// <returns>A random sample.</returns>
 public float Sample(IRandomSource rng)
 {
     return(ZigguratGaussian.Sample(rng, _mean, _stdDev));
 }