Timeline for rand number generator with limits in ruby
Current License: CC BY-SA 3.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 8, 2014 at 9:38 | comment | added | tokland |
@CarySwoveland: Not that efficiency is important here (those are small arrays), but note that reduce with + leads to O(n^2) code.
|
|
Jan 8, 2014 at 7:54 | comment | added | Cary Swoveland |
I can't improve on your "I'd write:", but here's a variant: ranges.reduce([]) {|arr, range| arr + Array.new(range.size) {rand(range)}}.shuffle
|
|
Dec 17, 2013 at 9:55 | history | edited | tokland | CC BY-SA 3.0 |
deleted 132 characters in body
|
Dec 16, 2013 at 18:56 | history | edited | tokland | CC BY-SA 3.0 |
added 59 characters in body
|
Dec 11, 2013 at 18:08 | history | edited | tokland | CC BY-SA 3.0 |
deleted 7 characters in body
|
Dec 11, 2013 at 16:27 | vote | accept | JohnMerlino | ||
Dec 11, 2013 at 12:11 | history | edited | tokland | CC BY-SA 3.0 |
added 143 characters in body
|
Dec 11, 2013 at 9:52 | history | edited | tokland | CC BY-SA 3.0 |
added 2 characters in body
|
Dec 11, 2013 at 9:19 | history | edited | tokland | CC BY-SA 3.0 |
deleted 4 characters in body
|
Dec 11, 2013 at 9:11 | history | edited | tokland | CC BY-SA 3.0 |
deleted 38 characters in body
|
Dec 11, 2013 at 9:03 | history | answered | tokland | CC BY-SA 3.0 |