C
C#11mo ago
HD-Fr0sT

How do i make a random a static?

got any tips?
No description
6 Replies
Angius
Angius11mo ago
What are you trying to do, exactly?
HD-Fr0sT
HD-Fr0sTOP11mo ago
a random number that is random once and is the same value and later will be random again
Angius
Angius11mo ago
Store it outside of the loop, then So it won't change inside of it
MODiX
MODiX11mo 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
Angius11mo ago
As you can see, always the same
HD-Fr0sT
HD-Fr0sTOP11mo ago
i am severly brain dead
Want results from more Discord servers?
Add your server