Originally posted by Ken Manohar:
int randomNumber = (int) Math.random() * 10;
The variable randomNumber will produce a number lying between 0 and 9 inclusive.
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.
Hot dog! An advertiser loves us THIS much:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earthhttps://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter