public int nextCount ( int max ) throws DapException { int min = 1 ; if ( max < min || min < 1 ) throw new DapException ( "bad range" ) ; int range = ( max + 1 ) - min ; // min..max+1 -> 0..(max+1)-min int n = random . nextInt ( range ) ; // 0..(max+1)-min n = n + min ; // min..(max+1) if ( DEBUG ) System . err . println ( "RandomValue.nextCount: " + n ) ; return n ; }
Return an integer in range 1 .. max inclusive .