Whats wrong with the following code for generating a pseudo-random integer between 0 and n-1?
int r = (int) (Math.random() * n); // not recommended!! It can be slower than necessary since it performs two int to double conversions and a floating point multiply. Also, Math.random gives you no control over the seed, which is useful for debugging. Nevertheless, we use this approach for simplicity, before we introduce objects and Random. Also, if n is very large, the values produced are far from uniformly random, even if Math.random is.