non-iterative Number
how can return non-iterative numbers random method?
system.random is pseudo-random number generator. for purposes, fine, it's going "random" given specific seed value.
for this, you'd make series of numbers like:
random rand = new random(); // optionally provide seed int numberstogenerate = 500; ienumerable<int> numbers = enumerable.repeat(0, numberstogenerate).select(i => rand.next());
if want avoid pseudo-randomness, , provide more elaborate, such using cryptography provider:
int numberstogenerate = 500; var provider = new rngcryptoserviceprovider(); byte[] data = new byte[4]; list<int> numbers = new list<int>(); for (int i=0;i<numberstogenerate;++i) { provider.getbytes(data); numbers.add(bitconverter.toint32(data, 0)); }
reed copsey, jr. - http://reedcopsey.com
if post answers question, please click "mark answer" on post , "mark helpful".
Visual Studio Languages , .NET Framework > Visual C#
Comments
Post a Comment