0

Hi Everyone!

Is there anyway to create A program which can demonstrate the following function:

A capsule machine(Similar to a candy machine),when you,say,insert a coin into it and can randomly pop out a capsule containing an item in it?

How(or any possible way)is to code the probability for a particular capsule which contains the rare items in it to pop out?(example: If the machine has total of 10 capsules in it.1 contains a red ball,3 with blue balls and 6 black balls.So the probability for the only red ball to come out would be 1/10)

Right now I only have the idea but not skilled enough to create.

Anyone can point me in the direction of achieving this problem?

Cheers!