How can I generate a random number? I find the Random class in the API Documentation but I fail to understand how to use it.
Thanks.
How can I generate a random number? I find the Random class in the API Documentation but I fail to understand how to use it.
Thanks.
I have the same question. Can anyone provide the example? Big Thanks!
var random = new Random(17); // or use (int)Uno.Diagnostics.Clock.GetTicks() to generate seed
random.NextInt(); // random int
random.NextInt(3, 5); // random int at range [3, 5]
random.SetSeed(43);
random.NextFloat(0.05f, 0.95f); // random float
random.NextFloat();
random.NextFloat2(); // random float2 structure
Problem solved. Thanks for your help.