Java ThreadLocalRandom randomAge()

Here you can find the source of randomAge()

Description

Random age.

License

Apache License

Return

the integer

Declaration

public static int randomAge() 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.concurrent.ThreadLocalRandom;

public class Main {
    private static final int MAX_AGE = 120;
    private static final ThreadLocalRandom random = ThreadLocalRandom
            .current();//from w w w  .j a va2 s. c  o  m

    /**
     * Random age.
     *
     * @return the integer
     */
    public static int randomAge() {
        return random.nextInt(MAX_AGE);
    }
}

Related

  1. random()
  2. random(char lower, char upper, int length)
  3. random(double min, double max)
  4. random(int min, int max)
  5. random(T[] array)
  6. randomAlphabetic(int length)
  7. randomBoundedInclusiveInt(int start, int end)
  8. randomCase(String input)
  9. randomChar()