The below code is copied from a paper, undergrad work was linked to from a wikipedia page. I believe I've spotted some flaws in the paper and some in the code but as I have no C# experience I just want to double check.
My understanding is that this code was meant to create a large psuedo totally random number but instead I believe it creates a large number which is a reoccuring smaller random number. ie. 123123123 instead of 123784675. Can someone please confirm what the code does.
What I read here http://csharpindepth.com/Articles/Chapter12/Random.aspx and on Stackoverflow in various posts makes me believe that it's using the same seed and hence getting the same number each iteration and just appending that same number over and over.
Random randomNumber = new Random();
counter = 0;
for (int j = 0; j < 1; j++)
{
StringBuilder largeRandomNumber = new StringBuilder();
for (int i = 0; i < 40000; i++)
{
int value = randomNumber.Next(11111, 99999);
largeRandomNumber.Append(value);
}
}
Random r = new Random(1); r.next(0,10) // will return "2"This will ALWAYS return 2 (even in 50 years!), cause thats, what "seed 1" will return! Use "no seed", then C# will take the "micro-time" which will Never ever be the Same number, unless you manage to generate the next number within the same micro second than the previous.