Does that output what you expect? Maybe you should use the java.util.Random class and use that to test, see if you get some obviously incorrect results, if not, your code probably runs fine.