Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/ruby
- ACCOUNTS = 1_000_000
- REPETITION = 100
- OTP_SIZE = 6
- require 'securerandom'
- REPETITION.times do
- guessed = Array.new(3, 0)
- for i in 0..ACCOUNTS
- otp = SecureRandom.random_number(("9"*OTP_SIZE).to_i)
- for j in 0..2
- guessed[j] +=1 if SecureRandom.random_number(("9"*OTP_SIZE).to_i) == otp
- end
- end
- puts "TOTAL GUESSED: #{guessed.sum.to_s} (#{guessed[0].to_s}, #{guessed[1].to_s}, #{guessed[2].to_s})"
- end
Advertisement
Add Comment
Please, Sign In to add comment