C
C#5mo ago
HD-Fr0sT

How do i make a random a static?

got any tips?
No description
6 Replies
Angius
Angius5mo ago
What are you trying to do, exactly?
HD-Fr0sT
HD-Fr0sT5mo ago
a random number that is random once and is the same value and later will be random again
Angius
Angius5mo ago
Store it outside of the loop, then So it won't change inside of it
MODiX
MODiX5mo ago
Angius
REPL Result: Success
int rnd = Random.Shared.Next(0, 10);
for (int i = 0; i < 5; i++)
{
Console.WriteLine(rnd);
}
int rnd = Random.Shared.Next(0, 10);
for (int i = 0; i < 5; i++)
{
Console.WriteLine(rnd);
}
Console Output
8
8
8
8
8
8
8
8
8
8
Compile: 356.685ms | Execution: 61.274ms | React with ❌ to remove this embed.
Angius
Angius5mo ago
As you can see, always the same
HD-Fr0sT
HD-Fr0sT5mo ago
i am severly brain dead