Graph sim
2015-05-17, post № 29
programming, Pygame, Python, #bar, #bar graph, #bars, #color, #color change, #colors, #different colors, #generates, #generator, #graph, #pseudo random, #random, #WolframAlpha
Thinking of graphs — especially bar graphs — as a pretty piece of art I wanted to create something related. But due to me not having any data I could graph, I decided to just use randomly generated data. It has no real purpose rather than look good.
Some calculations
- All of these calculations are based on
random.randint()
being perfectly random. Due to it being pseudo-random this will just be an approximation. To get further information, click on the equation to view them in Wolfram Alpha. - The chance of two adjacent bars having the same color:
- The chance of two adjacent bars having the same color and size, where
- :
- The chance of the screen not showing anything, which means every bar has the background color and
- :
- Although these probabilities are very unlikely, they — theoretically — could occur.
Source code: graph-sim.py