Prevent duplicates. Refreshing the page successfully gives a different result every time.

This commit is contained in:
Simon Quigley 2023-09-13 04:56:23 -05:00
parent 86a262f11b
commit 57bc2cfac8

View File

@ -1,8 +1,8 @@
class MoviesController < ApplicationController
def index
@movies = ["Iron Man", "Batman", "Forrest Gump"]
@choices, @movies = ["Iron Man", "Batman", "Forrest Gump"], []
(0..15).each{ |num|
@movies.append(@movies.sample())
@movies.append(@choices.sample())
}
end
end