Logo

Programming-Idioms

History of Idiom 11 > diff from v13 to v14

Edit summary for version 14 by :

Version 13

2015-08-27, 21:57:32

Version 14

2015-08-27, 21:58:20

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.

Code
element := x[random(length(x))];
Code
element := x[random(length(x))];
Comments bubble
if x is an Array
Comments bubble
if x is an Array
Origin
http://www.programming-idioms.org/idiom/11/pick-a-random-element-from-a-list/618/delphi