Java Random rand()

Here you can find the source of rand()

Description

pseudo-random number based on linear congruential method

License

Open Source License

Return

a pseudo-random number 0 through 32767.

Declaration

public static int rand() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    private static long holdrand_;

    /**//from   w ww .  j  av  a  2 s. c  o m
     * pseudo-random number based on linear congruential method
     * 
     * @return a pseudo-random number 0 through 32767.
     * @see http://en.wikipedia.org/wiki/Linear_congruential_generator
     */
    public static int rand() {
        holdrand_ = holdrand_ * 214013L + 2531011L;
        return (int) ((holdrand_ >> 16) & 0x7fff);
        // return (int)(randomizer.nextInt());

    }
}

Related

  1. getRandomUUID()
  2. isRandomList(List list)
  3. medianHelper(List list, int k, Random r)
  4. multSample(Random rng, double[] vals, double normsum)
  5. permute(Object[] arr, Random random)
  6. Rand()
  7. randAngle()
  8. randFloat(float min, float max)
  9. random()