Picking a random member of a Type List

BlitzMax Forums/BlitzMax Beginners Area/Picking a random member of a Type List

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

you know how big the list is (List.Count) so you can make a random number from 1 to Count. Then loop through the list with For m:MyType = Each In MyList and keep a counter incrementing each time and when the counter is the same as the precalculated random number, use Exit to break out of the list and m is set to the random type.

Hope that makes sense.