One brain: pure random number generator
Package first;/* * Pure random number generator * Generates 1000 random integers */public class Testrandom {public static void Main (string[] args) { //T ODO auto-generated Method Stub Long seed = System.currenttimemillis ();//seed int i; int count = 0; Modulus=231-1=int. MaxValue //multiplier=75=16807 long random = (16807 * seed)% Integer.max_value; for (i = 1; I <=, i++) { random = (16807 * random)% Integer.max_value; System.out.print (random + ""); count++; if (count% 5 = = 0) System.out.println ();}}}
Run
See some of the System.out.println () methods in the JDK
/** * Prints an integers and then terminate the line. This method behaves as * Though it invokes <code>{@link #print (int.)}</code> and then * <code>{@ Link #println ()}</code>. * * @param x the <code>int</code> to is printed. */Public void println (int. x) { synchronized (this) { print (x); NewLine (); } } /** * Prints a String and then terminate the line. This method behaves as * Though it invokes <code>{@link #print (String)}</code> and then * <code& Gt {@link #println ()}</code>. * * @param x the <code>String</code> to is printed. */Public void println (String x) { synchronized (this) { print (x); NewLine (); } }
Four weeks of brain-moving