in reply to Generating 0 .. N Randomly and Efficiently
One alternative is to do random selection (repeating until successful) for the first X percent of N, then switching to scanning through the whole bitmap until you find the rand(number-remaining)'th remaining number. Some benchmarks would be needed to pick a good X; I'd guess 90%.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Generating 0 .. N Randomly and Efficiently
by Limbic~Region (Chancellor) on Oct 19, 2004 at 17:20 UTC |