commit ab623856e73eaabba0d28947da94e6b8cedbb96c
parent 8e8cabf50b94a55c44f392df93068d85fe69528b
Author: Dominik Schmidt <das1993@hotmail.com>
Date: Sun, 2 Aug 2015 11:55:39 +0200
Move chooseRandom into class.
Prevents namecollisions with other packages.
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/dfortune.d b/dfortune.d
@@ -33,6 +33,9 @@ class Fortune : RandomAccessFinite!(string){
return 5*uint.sizeof+char.sizeof;
}
}
+ static package auto chooseRandom(T)(T r) if( hasLength!(T) && isRandomAccessRange!(T) ){
+ return r[uniform(0,r.length)];
+ }
Header header;
string basename;
File table,content;