Skip to content

Plotting histograms in the terminal

When I was experimenting with random number generators, I wanted to get a sense of the distribution of numbers.

And in this case: A histogram says more than 1,000 samples.

When I'm in Python I just grab matplotlib for this kind of stuff, but I was in C, reinvening my own RNG from scratch.

I didn't feel like whipping up an entire graphics library. So I wanted to try to see what I can do by simply printing to the terminal.

Sample some data

I want to describe the process using examples, so let's sample some random numbers.