I tried to get a random number between 3 and 6 (inclusive):
public class A {
Random ran = new Random();
public func1(){
x = 3 + ran.nextInt(7); // need Random number x from 3 to 6
y = 3 + ran.nextInt(7)
}
}
but it often gives results 8
and 9
! How it can be ?
I used
x=(int) (3 + Math.random()*6);
its give 8 sometimes too...
where is an Error???