Java Random Int getRandomInt(int sek, int min, int max)

Here you can find the source of getRandomInt(int sek, int min, int max)

Description

get Random Int

License

Apache License

Declaration

public static int getRandomInt(int sek, int min, int max) 

Method Source Code

//package com.java2s;
/**//ww  w.java  2 s  . c  o m
  *  Copyright (c) 2014 http://www.lushapp.wang
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  */

import java.util.*;

public class Main {

    public static int getRandomInt(int sek, int min, int max) {

        Random random = new Random();

        int temp = 0;

        do {
            temp = random.nextInt(sek);
        } while (temp < min || temp > max);

        return temp;
    }
}

Related

  1. getRandomInt(int max)
  2. getRandomInt(int min, int max)
  3. getRandomInt(int min, int max)
  4. getRandomInt(int min, int max, Random random)
  5. getRandomInt(int minimum, int maximum)
  6. getRandomInt(int size)
  7. getRandomInt(Random rand, int lower, int upper)
  8. getRandomInt(String level)
  9. getRandomIntBetween(int low, int high)