Hi,
I was wondering about this and thought I asked if someone can tell me. This isn't a homework question or anything like that, it's actually something I implemented in a facebook app game.
So let's say I have 20 items, [id1,id2,id3...id20]
I select a random number (Y) from 1 to 20
if (Y <= 5)
then I get another random number from 1 to 20 and set that as the item
Else, I set Y as the item
For example,
case 1:
random number is 8, item = id8
case 2:
random number is 4, so i get another random number and it is 15, so item = id15
case 3:
random number is 4, so i get another random number and it is 3, so item is id3
now my question is what is the % chance of getting a number from 1 to 5 giving these conditions? My guess is that it is 2.5 %, but I know that's not right