lundi 8 juin 2015

I'd like to make a Biased Lottery System in Swift

My friends and I want to have a system for deciding who has to drive when we hang out. We could just rotate, but as an aspiring coder, I took it as an opportunity to try to apply coding to my real life.

This is how I'll Explain it:

There are 9 people in the lottery. after each person drives their "number" is increased to 1, and the lottery is always from the people with the lowest number. One person drives. Now they have a "number" of 1, so the other 8 people have 0, meaning the lottery will be from all of the people who have driven the least amount of times.

I feel like this is basic enough that I feel like either there are other people who have done this before that i could be pointed toward, or one of you have the knowledge to be able to show me the way. Thanks!




Aucun commentaire:

Enregistrer un commentaire