Re: [algogeeks] Masked random generator

2013-10-08 Thread atul anand
can't we use idea of reservoir sampling here ? On Tue, Oct 8, 2013 at 8:18 PM, Don wrote: > Provide a function which returns a value randomly and uniformly selected > from the range 0..N-1 excluding values in the array a[S] containing sorted > values in the same range. A rejection algorithm wou

[algogeeks] Masked random generator

2013-10-08 Thread Don
Provide a function which returns a value randomly and uniformly selected from the range 0..N-1 excluding values in the array a[S] containing sorted values in the same range. A rejection algorithm would work well enough if S is much smaller than N, but what if N is large and S is slightly smaller