Originally posted by Ken Manohar:
int randomNumber = (int) Math.random() * 10;
The variable randomNumber will produce a number lying between 0 and 9 inclusive.
Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Originally posted by David Weitzman:
Maybe you should really do it yourself with a custom binary search and the int[] type instead of a List of Integers, to save the time wasted on indirection. Use some magic number like -1 instead of setting things to null or removing them.
Originally posted by Dirk Schreckmann:
I tried it this way. I got 1,000,000 reps down to 13 to 17 seconds and 10,000,000 reps down to 180 to 190 seconds. (By no means do I pretend to be an efficiency expert - or beginner.)
Should anybody figure out a fast/efficient way of doing this (maybe 100,000,000 in under a minute), I'd be curious to learn what you figured out.
Good Luck.
Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog