Pitagora souchi [transcribed], which (according to Wikipedia) is the Japanese name for Rube Goldberg machines and means Pythagoras switch or Pythagorean Machine. The clip is supposedly edited from an educational TV-show by that name, featuring such machines at the beginning and end of each episode.
Anyway, I'm willing to bet that for some of those machines, they had to run them a number of times before they got the desired result. Some of them in particular seem to have locations where the result would be slightly randomized.