804505890f
with distributed objects rather than having a single handleEvent() by which all subscribers are forced to hear about all events. Now one subscribes separately and then adds onesself as any of a few types of listener once they have access to the subscribed object reference. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@439 542714f4-19e9-0310-aa3c-eee0fc999fb1
28 lines
761 B
Java
28 lines
761 B
Java
//
|
|
// $Id: MathUtil.java,v 1.1 2001/10/12 00:03:03 mdb Exp $
|
|
|
|
package com.threerings.parlor.util;
|
|
|
|
import java.util.Random;
|
|
|
|
/**
|
|
* Contains math-related utility functions that are pertinent to game
|
|
* development.
|
|
*/
|
|
public class MathUtil
|
|
{
|
|
/**
|
|
* Returns a pseudo-random integer in the range from zero (inclusive)
|
|
* to <code>maxValue</code> (exclusive). This presently uses an
|
|
* instance of {@link Random} which uses a 48-bit seed, which is
|
|
* modified using a linear congruential formula. (See Donald Knuth,
|
|
* The Art of Computer Programming, Volume 2, Section 3.2.1.)
|
|
*/
|
|
public static int random (int maxValue)
|
|
{
|
|
return _random.nextInt(maxValue);
|
|
}
|
|
|
|
protected static Random _random = new Random();
|
|
}
|