Created
March 30, 2011 09:22
-
-
Save joshnesbitt/894115 to your computer and use it in GitHub Desktop.
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
| def random | |
| find(:first, :offset => (count * rand).to_i) | |
| end |
(count * rand).to_i should be written as rand(count)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Or how about getting mysql to do the random? https://gist.github.com/894170