Created
November 3, 2012 20:08
-
-
Save zeroeth/4008552 to your computer and use it in GitHub Desktop.
srand
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| srand(100) | |
| 10.times.collect{ rand(5) } | |
| [0, 0, 3, 0, 2, 4, 2, 2, 2, 2] | |
| 10.times.collect{ rand(5) } | |
| [1, 0, 0, 4, 3, 4, 2, 0, 3, 1] | |
| # repeat, see same creation again with seed 100 | |
| srand(100) | |
| 10.times.collect{ rand(5) } | |
| [0, 0, 3, 0, 2, 4, 2, 2, 2, 2] | |
| 10.times.collect{ rand(5) } | |
| [1, 0, 0, 4, 3, 4, 2, 0, 3, 1] | |
| # you as a number | |
| your_face = "laurel".split(//).collect{|letter| letter.ord}.join.to_i | |
| srand(your_face) | |
| 10.times.collect{ rand(5) } | |
| [4, 4, 4, 1, 2, 4, 2, 4, 4, 0] | |
| 10.times.collect{ rand(5) } | |
| [4, 2, 2, 1, 0, 0, 3, 4, 2, 2] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment