Last active
August 29, 2015 14:03
-
-
Save coleww/cfaea55b92570ea9fced to your computer and use it in GitHub Desktop.
using fibonacci in a web app
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 set_amount | |
fibs = [0, 1] | |
self.amount = ([10, 7, 5, 3, 2, 1].map { |amt| [amt] * (fibs[0], fibs[1] = fibs[1], fibs[0] + fibs[1])[0]}.flatten).sample | |
end | |
#i really wish i could find a way to not have to declare the fibs array... | |
#this is for like a raffle type thing. | |
what the... do you want feedback?
explain the use case?
Why do you need to use fibonacci's sequence? Why can't you just generate a random array and sample it?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
YOU LOVE THAT RAW ONE LINER
DONT YOU WISH YOU WORKED WITH ME?