Skip to content

Instantly share code, notes, and snippets.

@jonelf
Last active October 3, 2017 21:32
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonelf/3030a7d343f691348c68 to your computer and use it in GitHub Desktop.
Save jonelf/3030a7d343f691348c68 to your computer and use it in GitHub Desktop.
A "random" FizzBuzz in Ruby. This is just for fun.
c = ('a'..'z').to_a
srand(1792579 * 1800)
f = (0..3).map { c[rand(26)] }
b = (0..3).map { c[rand(26)] }
a = [f, b].map {|s| s.join.capitalize }
srand(s = 93113 * 19243)
puts (0..99).map{|i| [a[0], a[0] + a[(srand(s) if i%15 < 1) || 1].to_s, a[1], i+1][rand(4)] }
@jonelf
Copy link
Author

jonelf commented Aug 2, 2017

a=%w[Fizz ☹ Buzz]
a[1]=a[0]+a[2]
srand(1791773459)
((0..14).map{rand(4)}*7)[0..99].each_with_index{|v,i|puts a[v]||i+1}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment