From 53426bc5c495b863230ba5aa26c05cd5e5c4c542 Mon Sep 17 00:00:00 2001 From: Walter Korman Date: Tue, 23 Oct 2001 02:01:29 +0000 Subject: [PATCH] Initial version. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@524 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/java/com/threerings/util/RandomUtil.java | 29 ++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/java/com/threerings/util/RandomUtil.java diff --git a/src/java/com/threerings/util/RandomUtil.java b/src/java/com/threerings/util/RandomUtil.java new file mode 100644 index 000000000..b715d1615 --- /dev/null +++ b/src/java/com/threerings/util/RandomUtil.java @@ -0,0 +1,29 @@ +// +// $Id: RandomUtil.java,v 1.1 2001/10/23 02:01:29 shaper Exp $ + +package com.threerings.media.util; + +import java.util.Random; + +/** + * Provides miscellaneous utility routines to simplify obtaining + * useful random number values and to centralize seeding and proper + * care and feeding of the pseudo-random number generator. + */ +public class RandomUtil +{ + /** + * Returns a pseudorandom, uniformly distributed int + * value between 0 (inclusive) and the specified value + * (exclusive). + * + * @param high the high value limiting the random number sought. + */ + public static int getInt (int high) + { + return _rnd.nextInt(high); + } + + /** The random object from which we choose random numbers. */ + public static Random _rnd = new Random(); +}