Created
January 14, 2024 16:31
-
-
Save hainesr/1d4e7c07e48fee0e86051c0569d0513c to your computer and use it in GitHub Desktop.
Simple Ruby method to generate bingo numbers
This file contains 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 bingo(max) | |
seen = [] | |
while(seen.size < max) | |
r = Random.rand(1..max) | |
next if seen.include?(r) | |
seen << r | |
end | |
seen | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment