Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
JDK 1.1 Source Code Directory
JDK 1.1 source code directory contains Java source code for JDK 1.1 core classes: "C:\fyicenter\jdk-1.1.8\src".
Here is the list of Java classes of the JDK 1.1 source code:
✍: FYIcenter
⏎ java/util/Random.java
/* * @(#)Random.java 1.18 01/12/10 * * Copyright 2002 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ package java.util; /** * An instance of this class is used to generate a stream of * pseudorandom numbers. The class uses a 48-bit seed, which is * modified using a linear congruential formula. (See Donald Knuth, * <i>The Art of Computer Programming, Volume 2</i>, Section 3.2.1.) * <p> * If two instances of <code>Random</code> are created with the same * seed, and the same sequence of method calls is made for each, they * will generate and return identical sequences of numbers. * <p> * Many applications will find the <code>random</code> method in * class <code>Math</code> simpler to use. * * @author Frank Yellin * @version 1.18, 12/10/01 * @see java.lang.Math#random() * @since JDK1.0 */ public class Random implements java.io.Serializable { private long seed; private final static long multiplier = 0x5DEECE66DL; private final static long addend = 0xBL; private final static long mask = (1L << 48) - 1; /** * Creates a new random number generator. Its seed is initialized to * a value based on the current time. * * @see java.lang.System#currentTimeMillis() * @since JDK1.0 */ public Random() { this(System.currentTimeMillis()); } /** * Creates a new random number generator using a single * <code>long</code> seed. * * @param seed the initial seed. * @see java.util.Random#setSeed(long) * @since JDK1.0 */ public Random(long seed) { setSeed(seed); } /** * Sets the seed of this random number generator using a single * <code>long</code> seed. * * @param seed the initial seed. * @since JDK1.0 */ synchronized public void setSeed(long seed) { this.seed = (seed ^ multiplier) & mask; haveNextNextGaussian = false; } /** * Generates the next pseudorandom number. Subclass should * override this, as this is used by all other methods. * * @param bits random bits * @return the next pseudorandom value from this random number generator's sequence. * @since JDK1.1 */ synchronized protected int next(int bits) { long nextseed = (seed * multiplier + addend) & mask; seed = nextseed; return (int)(nextseed >>> (48 - bits)); } private static final int BITS_PER_BYTE = 8; private static final int BYTES_PER_INT = 4; /** * Generates a user specified number of random bytes. * * @since JDK1.1 */ public void nextBytes(byte[] bytes) { int numRequested = bytes.length; int numGot = 0, rnd = 0; while (true) { for (int i = 0; i < BYTES_PER_INT; i++) { if (numGot == numRequested) return; rnd = (i==0 ? next(BITS_PER_BYTE * BYTES_PER_INT) : rnd >> BITS_PER_BYTE); bytes[numGot++] = (byte)rnd; } } } /** * Returns the next pseudorandom, uniformly distributed <code>int</code> * value from this random number generator's sequence. * * @return the next pseudorandom, uniformly distributed <code>int</code> * value from this random number generator's sequence. * @since JDK1.0 */ public int nextInt() { return next(32); } /** * Returns the next pseudorandom, uniformly distributed <code>long</code> * value from this random number generator's sequence. * * @return the next pseudorandom, uniformly distributed <code>long</code> * value from this random number generator's sequence. * @since JDK1.0 */ public long nextLong() { // it's okay that the bottom word remains signed. return ((long)(next(32)) << 32) + next(32); } /** * Returns the next pseudorandom, uniformly distributed <code>float</code> * value between <code>0.0</code> and <code>1.0</code> from this random * number generator's sequence. * * @return the next pseudorandom, uniformly distributed <code>float</code> * value between <code>0.0</code> and <code>1.0</code> from this * random number generator's sequence. * @since JDK1.0 */ public float nextFloat() { int i = next(24); return i / ((float)(1 << 24)); } /** * Returns the next pseudorandom, uniformly distributed * <code>double</code> value between <code>0.0</code> and * <code>1.0</code> from this random number generator's sequence. * * @return the next pseudorandom, uniformly distributed * <code>double</code> value between <code>0.0</code> and * <code>1.0</code> from this random number generator's sequence. * @since JDK1.0 */ public double nextDouble() { long l = ((long)(next(26)) << 27) + next(27); return l / (double)(1L << 53); } private double nextNextGaussian; private boolean haveNextNextGaussian = false; /** * Returns the next pseudorandom, Gaussian ("normally") distributed * <code>double</code> value with mean <code>0.0</code> and standard * deviation <code>1.0</code> from this random number generator's sequence. * * @return the next pseudorandom, Gaussian ("normally") distributed * <code>double</code> value with mean <code>0.0</code> and * standard deviation <code>1.0</code> from this random number * generator's sequence. * @since JDK1.0 */ synchronized public double nextGaussian() { // See Knuth, ACP, Section 3.4.1 Algorithm C. if (haveNextNextGaussian) { haveNextNextGaussian = false; return nextNextGaussian; } else { double v1, v2, s; do { v1 = 2 * nextDouble() - 1; // between -1 and 1 v2 = 2 * nextDouble() - 1; // between -1 and 1 s = v1 * v1 + v2 * v2; } while (s >= 1); double multiplier = Math.sqrt(-2 * Math.log(s)/s); nextNextGaussian = v2 * multiplier; haveNextNextGaussian = true; return v1 * multiplier; } } }
⏎ java/util/Random.java
Or download all of them as a single archive file:
File name: jdk-1.1.8-src.zip File size: 1574187 bytes Release date: 2018-11-16 Download
⇒ Backup JDK 1.1 Installation Directory
2018-11-17, 159776👍, 0💬
Popular Posts:
What Is ojdbc7.jar for Oracle 12c R1? ojdbc7.jar for Oracle 12c R1 is the JAR files of ojdbc.jar, JD...
Snappy-Java is a Java port of the "snappy", a fast C++ compresser/decompresser developed by Google. ...
How to download and install xml-commons External Source Package? The source package contains Java so...
How to display types defined in an XML Schema file with the xs\QueryXS.java provided in the Apache X...
maven-compat-3.8.6.jar is the JAR file for Apache Maven 3.8.6 Compact module. The JAR file name may ...