I have a pretty simple application that needs to (as fairly as possible) randomly assign a person to a team.
At the moment, I am iterating through with a few different methods.
Team.where(assigned: false).order("RANDOM()").first
as well as loading it into an array and using sample()
arr.sample().inspect
However, these don't appear to be truly random, they typically leave the edges (1,2..8,9 where count = 10) til last. Is there a better method that does or doesn't involve AR? Is there a mathematically noticeable difference between PSQL rand and sqlite3 random()?
Any assistance on loops to generate said random distribution are appreciated!