I am looking for a nice app that would enable me to create "automatically" nice urns filled with balls of two different colors, following the illustration below (actual colors do not matter, being able to write something on the balls is a plus):

"An urn is filled with 10 balls, 5 blue and 5 red. If you draw a red one, you earn 2 000€, if you draw a blue one, you earn 1 000€".

An urn filled with blue and red balls

I am looking for an automatic way to do it as I need to create a 100 of those urns, with different probabilities (number of balls of each color) and amounts. Have you ever heard of some kind of app which would do that?

Thank you!!

  • 1
    $\begingroup$ I don't know of an app; seems rather specific. It would not be difficult to write a program to generate an unlimited number of examples, in Processing, Matlab, SageMath, Mathematica, ... $\endgroup$ Jul 2, 2018 at 23:12
  • $\begingroup$ What should be the output? Image? $\endgroup$
    – Jasper
    Jul 3, 2018 at 7:43
  • $\begingroup$ Yes, an image would be fine. $\endgroup$
    – L. M.
    Jul 3, 2018 at 8:37
  • $\begingroup$ It's possible that Fathom or Tinkerplots can do this, but I'm not sure. $\endgroup$
    – mweiss
    Jul 4, 2018 at 3:46

2 Answers 2


I whipped up this: urn creator. Maybe it's useful. Feel free to suggest improvements.

  • $\begingroup$ In Google Chrome / MacOS I only see a blank screen below the sliders... Ah, but it works in Safari. Nice! $\endgroup$ Jul 4, 2018 at 16:39
  • $\begingroup$ There was a typo leading to an undefined variable. FF and Safari didn't seem to care. Not it works in chromium as well, chrome should do too. $\endgroup$
    – Jasper
    Jul 4, 2018 at 19:03
  • $\begingroup$ It is more than useful, it was exactly what I was looking for! Thank you so much, this is amazing. $\endgroup$
    – L. M.
    Jul 6, 2018 at 11:21
  • 1
    $\begingroup$ Hi Jasper, the page did not work for me in January 2022 on Chrome on Mac. I was able to fix it locally by changing line 172 to "var sketch = ..." instead of "sketch = ...". $\endgroup$
    – Duncan
    Jan 4 at 21:55
  • $\begingroup$ Updated, thanks. $\endgroup$
    – Jasper
    Jan 7 at 15:39

This is not that hard to do manually. I bet it takes you longer to research a program or build one than to just do it by hand.

Make a PowerPoint (or other drawing program that is the urn. Big enough to hold two stacks of at least 9 balls. You will have the blue ones always on the left and red ones always on the right. In separate stacks (not mingled as you showed here).

I assume the urns don't themselves need to follow some distribution (like stat mech microcanonical ensembles). So write out the urns in terms of number of blue and number of red:

blue: 0-9

red: 0-9

All the combinations of that give 100 choices (you do have one empty set, but if that is a problem just add the two 10-0 combinations and have 101 choices.

Make PPT drawing objects of 0-9 blue balls (stack them into 3-3). Use the group command (not critical for blue) and save a slide with each choice on it (in the urn). Now duplicate each slide 10 times (in slide sorter view with cut and paste command). You will then have a 100 slide presentation. When you do the copy do it 10 slides at a time (iow sort of "collated"...not 0 balls 10 times and then 1 ball 10 times, but ten times of 0, 1, 2, etc.

Create the ten different red ball objects (just make ten more slides at end of your presentation or make a separate presentation for the red ball objects. Here you do need to use the group command for the drawing object, because you will be cutting and pasting the objects into the 100 urns. Go one at a time and paste each of the ten objects into ten slides.

Probably take you a couple hours max.

Boom. Done.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.