List of usage examples for java.util Random Random
public Random()
From source file:com.beginner.core.utils.Tools.java
/** * ?????/*from w w w. java 2 s .c o m*/ * @return int ??? * @since 1.0.0 */ public static int getRandomNum() { Random r = new Random(); return r.nextInt(900000) + 100000; }
From source file:com.renatodelgaudio.awsupdate.IpUtil.java
/** * /*from ww w . j a v a2 s .c o m*/ * @return the known IP Provider in random order */ public static List<IpProvider> getIpProviders() { IpProvider providers[] = new IpProvider[2]; providers[0] = new IcanHazip(); providers[1] = new IpInfo(); int mainIndex = new Random().nextInt(2); int fallBackIndex = ~mainIndex + 2; List<IpProvider> ret = new ArrayList<IpProvider>(); ret.add(providers[mainIndex]); ret.add(providers[fallBackIndex]); return ret; }
From source file:airport.dispatcher.weather.Humidity.java
public Humidity() { value = new Random().nextInt(MAX_DEGREE - MIN_DEGREE) + MIN_DEGREE; if (LOG.isInfoEnabled()) { LOG.info("create Humidity"); }/*ww w . j a va 2 s.co m*/ }
From source file:net.mceoin.cominghome.api.NestUtil.java
public static String tellNestAwayStatus(String access_token, String structure_id, String away_status) { String result = tellNestAwayStatusCall(access_token, structure_id, away_status); if ((result.contains("Error:")) && (!result.contains("Unauthorized"))) { // Try again if it was an Error but not an Unauthorized try {//from w w w .ja v a 2 s . co m Random randomGenerator = new Random(); int seconds = 5 + randomGenerator.nextInt(10); log.info("retry in " + seconds + " seconds"); Thread.sleep(seconds * 1000); } catch (InterruptedException e) { e.printStackTrace(); } result = tellNestAwayStatusCall(access_token, structure_id, away_status); } return result; }
From source file:com.sawyer.advadapters.app.adapters.jsonadapter.UnitTestJSONArrayActivity.java
private static byte getByte() { byte[] buf = new byte[1]; new Random().nextBytes(buf); return buf[0]; }
From source file:com.davidoyeku.azure.practical.managment_demo.Vehicle.java
public Vehicle() { rand = new Random(); this.regPlate = generateLicense(); this.vehicleType = VEHICLE_TYPES[rand.nextInt(VEHICLE_TYPES.length)]; this.currentSpeed = rand.nextInt(100); // TODO Auto-generated constructor stub }
From source file:dtu.ds.warnme.utils.RandomUtils.java
public static EventType randomEventType() { int pick = new Random().nextInt(EventType.values().length); return EventType.values()[pick]; }
From source file:airport.dispatcher.weather.TemperatureCentigrade.java
public TemperatureCentigrade() { degree = new Random().nextInt(MAX_DEGREE - MIN_DEGREE) + MIN_DEGREE; if (LOG.isInfoEnabled()) { LOG.info("create"); }/*w w w . j a v a 2s .com*/ }