Four weeks of brain-moving

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.