src/share/classes/java/util/Random.java

Print this page
rev 794 : 6792545: Typo in java.util.Collection JavaDoc
6655123: Incorrect ref to The Art of Computer Programming in doc for java.util.Random
Summary: Fix a pair of typos.
Reviewed-by: jjg


  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  22  * CA 95054 USA or visit www.sun.com if you need additional information or
  23  * have any questions.
  24  */
  25 
  26 package java.util;
  27 import java.io.*;
  28 import java.util.concurrent.atomic.AtomicLong;
  29 import sun.misc.Unsafe;
  30 
  31 /**
  32  * An instance of this class is used to generate a stream of
  33  * pseudorandom numbers. The class uses a 48-bit seed, which is
  34  * modified using a linear congruential formula. (See Donald Knuth,
  35  * <i>The Art of Computer Programming, Volume 3</i>, Section 3.2.1.)
  36  * <p>
  37  * If two instances of {@code Random} are created with the same
  38  * seed, and the same sequence of method calls is made for each, they
  39  * will generate and return identical sequences of numbers. In order to
  40  * guarantee this property, particular algorithms are specified for the
  41  * class {@code Random}. Java implementations must use all the algorithms
  42  * shown here for the class {@code Random}, for the sake of absolute
  43  * portability of Java code. However, subclasses of class {@code Random}
  44  * are permitted to use other algorithms, so long as they adhere to the
  45  * general contracts for all the methods.
  46  * <p>
  47  * The algorithms implemented by class {@code Random} use a
  48  * {@code protected} utility method that on each invocation can supply
  49  * up to 32 pseudorandomly generated bits.
  50  * <p>
  51  * Many applications will find the method {@link Math#random} simpler to use.
  52  *
  53  * @author  Frank Yellin
  54  * @since   1.0
  55  */




  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  22  * CA 95054 USA or visit www.sun.com if you need additional information or
  23  * have any questions.
  24  */
  25 
  26 package java.util;
  27 import java.io.*;
  28 import java.util.concurrent.atomic.AtomicLong;
  29 import sun.misc.Unsafe;
  30 
  31 /**
  32  * An instance of this class is used to generate a stream of
  33  * pseudorandom numbers. The class uses a 48-bit seed, which is
  34  * modified using a linear congruential formula. (See Donald Knuth,
  35  * <i>The Art of Computer Programming, Volume 2</i>, Section 3.2.1.)
  36  * <p>
  37  * If two instances of {@code Random} are created with the same
  38  * seed, and the same sequence of method calls is made for each, they
  39  * will generate and return identical sequences of numbers. In order to
  40  * guarantee this property, particular algorithms are specified for the
  41  * class {@code Random}. Java implementations must use all the algorithms
  42  * shown here for the class {@code Random}, for the sake of absolute
  43  * portability of Java code. However, subclasses of class {@code Random}
  44  * are permitted to use other algorithms, so long as they adhere to the
  45  * general contracts for all the methods.
  46  * <p>
  47  * The algorithms implemented by class {@code Random} use a
  48  * {@code protected} utility method that on each invocation can supply
  49  * up to 32 pseudorandomly generated bits.
  50  * <p>
  51  * Many applications will find the method {@link Math#random} simpler to use.
  52  *
  53  * @author  Frank Yellin
  54  * @since   1.0
  55  */