in reply to Re^3: Generating 0 .. N Randomly and Efficiently
in thread Generating 0 .. N Randomly and Efficiently

ikegami,
As you noted, the list is never constructed - there is only an iterator that finds the next randomly chosen number. Additionally, a bitstring is compact. If you wanted to generate 0 .. 80_000_000, it would create a bitstring only about 1 mb in size.

Cheers - L~R

  • Comment on Re^4: Generating 0 .. N Randomly and Efficiently