Using Rnd
Rnd gives a double between 0 and 1, e.g., 0.410592664
To chose randomly among an integral number of things, say x, multiply Rnd by x and truncate … the result is a random integer between 0 and x-1
- Pick among 6 things:
- Rnd * 6 ? 0.410592664 * 6 ? 2.463555984 ? 2
- Rnd * 6 ? 0.092154388 * 6 ? 0.552926328 ? 0