Java examples for java.util:Random
get Random Ip Address
//package com.java2s; public class Main { public static String getRandomIpAddress() { return getRandomInt(0, 255) + "." + getRandomInt(0, 255) + "." + getRandomInt(0, 255) + "." + getRandomInt(0, 255); }/*from ww w . j av a2 s . co m*/ public static int getRandomInt() { return getRandomInt(1, Integer.MAX_VALUE); } public static int getRandomInt(int min, int max) { return min + (int) ((Math.random() * (max - min))); } }