Java examples for java.util:Random Int
next Random Int
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { int n = 2; System.out.println(next(n)); }/*from w ww. j a v a 2 s . co m*/ public static int next(int n) { return (int) (Math.random() * n); } }