Java Random Int getRandomInt(String level)

Here you can find the source of getRandomInt(String level)

Description

get Random Int

License

Apache License

Declaration

public static int getRandomInt(String level) 

Method Source Code

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

import java.util.Random;

public class Main {
    public static int getRandomInt(String level) {
        if (level.contains("-")) {
            String[] spl = level.split("-");
            return getRandomInt(Integer.parseInt(spl[0]),
                    Integer.parseInt(spl[1]));
        } else/*from  ww  w.j  a  va  2s  .c  o m*/
            return Integer.parseInt(level);
    }

    public static int getRandomInt(int min, int max) {
        Random random = new Random();
        return random.nextInt((max - min) + 1) + min;
    }
}

Related

  1. getRandomInt(int min, int max, Random random)
  2. getRandomInt(int minimum, int maximum)
  3. getRandomInt(int sek, int min, int max)
  4. getRandomInt(int size)
  5. getRandomInt(Random rand, int lower, int upper)
  6. getRandomIntBetween(int low, int high)
  7. getRandomIntBetween(int mi, int ma)
  8. getRandomInteger(int aStart, int aEnd)
  9. getRandomInteger(int min, int max)