getNormal() from Mark Johnson.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2913 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -126,13 +126,22 @@ public class Randoms
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> or <code>false</code> with approximately even probability.
|
||||
* Returns <code>true</code> or <code>false</code> with approximately even probability.
|
||||
*/
|
||||
public boolean getBoolean ()
|
||||
{
|
||||
return _r.nextBoolean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a pseudorandom, normally distributed <code>float</code> value around the
|
||||
* <code>mean</code> with the standard deviation <code>dev</code>.
|
||||
*/
|
||||
public float getNormal (float mean, float dev)
|
||||
{
|
||||
return (float)_r.nextGaussian() * dev + mean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a key from the supplied map according to a probability computed as
|
||||
* the key's value divided by the total of all the key's values.
|
||||
|
||||
Reference in New Issue
Block a user