Random
Introduction
How to get Random Integers
// Returns {0, 1, 2, or 3}
int randomNumber = FlatRedBallServices.Random.Next(4);// 3 is inclusive, 8 is exclusive, so possible values are {3, 4, 5, 6, or 7}
int randomNumber = FlatRedBallServices.Random.Next(3, 8);How to get Random Floats
float randomValue = FlatRedBallServices.Random.Between(0, 100);// Gets a number between 0 and 100...
float randomNumber = (float)FlatRedBallServices.Random.NextDouble() * 100;
// ...which may be used to position an object:
MyCharacter.X = randomNumber;How to Perform an Action at a Certain Percentage Chance
How to get Random Objects in a List
Last updated
Was this helpful?