Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- puts "write a number of how many times you wanna try, dont be a dipshit and write letters lol cuz im lazy"
- kek = gets.chomp.to_i
- t1 = Time.now
- def randomz
- if rand(0..1) == 0
- return true
- else
- return false
- end
- end
- array = []
- loop do
- @cash = 102400
- count = 0
- loop do
- count += 1
- input = 100
- loop do
- puts "#{@cash} #{array.length}"
- if randomz == true
- @cash += input
- break
- else
- @cash -= input
- end
- input = input*2
- break if input > @cash
- end
- array += count.to_s.split.map { |i| i.to_i } if input > @cash
- break if input > @cash
- end
- break if array.length == kek
- end
- t2 = Time.now
- delta = (t2 - t1).to_i
- puts "average: #{array.inject{ |sum, el| sum + el } / array.length} time: #{delta}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement