コード例 #1
0
 /// <summary>
 /// Generate a random value from the Gaussian distribution after
 /// modifying the parameters.
 ///
 /// <seealso>WeaponGenerator.randomizeAndClamp</seealso>
 /// </summary>
 /// <param name="parms">values, packed into a Vector4</param>
 /// <param name="modifier">value to modify each of the parameters by</param>
 /// <returns></returns>
 private float randomizeAndClamp(Vector4 parms, float modifier)
 {
     return((float)System.Math.Round(Mathf.Clamp(Gaussian.next(parms.z * modifier, (parms.w * modifier) * 0.5f), parms.x * modifier, parms.y * modifier), 2));
 }
コード例 #2
0
 /// <summary>
 /// Generate a random value from a Gaussian distribution and clamps it
 /// to the allowed min/max values.
 /// <para>x: minimum allowed value</para>
 /// <para>y: maximum allowed value</para>
 /// <para>z: mean value</para>
 /// <para>w: standard deviation</para>
 /// </summary>
 /// <param name="parms">values, packed into a Vector4</param>
 /// <returns>randomized value</returns>
 private float randomizeAndClamp(Vector4 parms)
 {
     return((float)System.Math.Round(Mathf.Clamp(Gaussian.next(parms.z, parms.w), parms.x, parms.y), 2));
 }