Request: Range.random, List.random #574
tactics
5 May 2009
This seems like it would be pretty nice.
In Python, I am also a huge fan of random.choice, which operates on any lenth-computable sequence. For Fan, I wouldn't mind a List.random which returned a random element of the (non-empty) list.
brian
5 May 2009
Promoted to ticket #574 and assigned to brian
will do, I'll add both List.random and Range.random
brian
6 May 2009
Renamed from Request: sys::Range.random to Request: Range.random, List.random
brian
6 May 2009
Ticket resolved in 1.0.42
KevinKelley
5 May 2009
No big deal, but I think having Range.random as a shortcut for Int.random(Range) seems nice:
It seems to fit the style of things like
10.times { /*do something*/ } (1..10).each { /*do something*/ }which I like.