Here's my simulation in Ruby. I know that one million is overkill, Lol
Spoilers below β
classThreaterdefself.run(iterations=1_000_000)last_person_got_seat=0.0total_runs=0.0iterations.timesdo|i|ifi%1000==0print("\rNΒΊ of iterations: #{i.to_s.ljust(iterations.to_s.length)}")endlast_person_got_seat+=1ifnew.last_person_got_seattotal_runs+=1endlast_person_got_seat/total_runsenddefinitialize(threater_size=100)@seats=[nil]*threater_size@seats[random_seat]=0# 1st in line lost her π(1...threater_size).to_a.eachdo|person_seat|seat_person(person_seat,person_seat)endenddeflast_person_got_seat@seats.last==99endprivatedefrandom_seatrand(0...@seats.length)enddefseat_person(seat,person)if@seats[seat]seat_person(random_seat,person)else@seats[seat]=personendendendresult=Threater.runputs"\nResult: #{result}%"
It's 50%, apparently!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Here's my simulation in Ruby. I know that one million is overkill, Lol
Spoilers below β
It's 50%, apparently!