samedi 27 février 2016

C# Random class strange errors

namespace RandomBug

{ class Program { static Random rnd = new Random(0); static void Main(string[] args) {
for (int i = 0; i < 1000000; i++) Program.rnd.Next(100);
}

}

}

This code gives me all kind of strange inner errors like: Null Access, Array out of range, etc. This not happen if the Random is not static. I'm using VS 2015. I found this problem after I saw bad random results on C# Unity.




Aucun commentaire:

Enregistrer un commentaire