Hi, I have a question about working of Random in C#. Say I want to execute some code if variable i == 0. I have the following code:
So, I would execute the code one time per 5 runnings of the template. And what if I had another code:
Would I have the same result in the final? (execution of the code one time per 5 runnings of the template)
Код:
Random rnd = new Random();
int i = rnd.Next(5);
if (i == 0){
//code to execute
}
Код:
Random rnd = new Random();
for (int j = 0; j < 10; j++){
int i = rnd.Next(50);
if (i == 0){
//code to execute
}
}