I quite like Soybomb’s nonsense word generator. It creates words that sound like they could be real words, but are usually made up words. They come in handy for more memorable nearly random character strings. I didn’t like having to load a website to get them though, and individually copy and paste them. So in about ten minutes, and about as many lines of code, I made this script to print out a selection of randomly generated words. BeautifulSoup and requests feel like such a wonderful swiss army knife of tools to have.
While visiting my mom for a few days, we played Boggle together. Whenever I play Boggle or put together puzzles, my mind veers off on tangents of how to implement an algorithm to do it for me. This time I realized I could bang out a board generator really easily. The random module comes with the useful shuffle and choice functions. So with a list of dice, all it took was shuffling them, then choosing a random face off of each one, then using fill from the textwrap module to shape the board.
In case you’re wondering — like I was — here are some stats about the dice in Boggle:
|letter||count||percentage of total||difference|
The difference is in percent, from the representation in Boggle to a 40,000 word sample statistical average.