Logo

Programming-Idioms

History of Idiom 11 > diff from v25 to v26

Edit summary for version 26 by :
[Pascal] Proper import

Version 25

2015-12-31, 01:01:37

Version 26

2016-02-07, 20:42:47

Idiom #11 Pick a random element from a list

List x must be non-empty.

Idiom #11 Pick a random element from a list

List x must be non-empty.

Imports
classes
Imports
uses classes;
Code
element := x.Items[random(x.count)];
Code
element := x.Items[random(x.count)];
Comments bubble
If x is a TList or TStrings -descendent
Comments bubble
If x is a TList or TStrings -descendent