Java Random number between 100 and 500 which is a multiple of 10 -
i want generate random number between 2 numbers multiples of 10. example, between 100 , 500, want generate uniform distribution of 110, 120 ... 490, 500.
i think better use random.nextint() per this post. not sure how that.
you can use function.
public int random() { random r=new random(); return (r.nextint(41)+10)*10; }
read math.random() versus random.nextint(int)
random.nextint(n) both more efficient , less biased math.random() * n
Comments
Post a Comment