New to Programming, How can I improve this random card draw?
JSFiddle link: http://ift.tt/2vh24aO
I don't know why it doesn't work in JSFiddle, but it does in my system (I would expect to see the "broken image link" icon). Hopefully you get the gist without seeing it in action.
I started learning JS a couple weeks ago.
With the js, I attempted to randomly select 7 items out of 40. Then, I run a handful of While loops saying while a randomly selected card equals another one, run that random selection again.
Finally, reveal the selected cards.
While I imagine there's a million different ways to do this, it seems to work.
Questions: * Is this truly a random selection? Or have I skewed it in any way? * Is there something fundamentally wrong or possibly too heavy in the way I solved this?
Thanks! I'm excited as this is my first "program".
Submitted July 13, 2017 at 12:03PM by aj1t1
via reddit http://ift.tt/2udOyb5