A Random Generator Toolkit

This post is part of a collection on Projects.

Shesha is a new project to simplify the process of making random generators. It comes out of problems I've repeatedly solved less adequately making bots over the years.


Here's a simple Tarot spread using the Rider-Waite deck. You can click to draw a new spread. This uses the "deck" functionality, which allows creating lists where elements won't be repeated in one run, just like a deck of cards.

And here's a simple adventure hook generator, with landscapes by John Robert Cozens. It uses both "die" and "deck" lists, as well as a few more complicated features.

You can check out the interactive editor here.


Starting as far back as chargen I've had a need to interpolate randomly-selected text in templates. There are a lot of of ways to do that, but an issue I had was a lack of support for differentiating lists where repeated selections were acceptable and those were they weren't. I tried making a system of prefixed tokens but it rapidly became a pain to use and resulted in an overly complicated parser.

Shesha addresses my needs with a few small but important design decisions:

  • items to be interpolated have explicit beginning and end markers
  • all interpolations support recursion
  • die/deck semantics are directly supported
  • interactive editor for quick work
  • minimal parser makes implementations in new languages easy

Embeddable generators have ended up taking up most of the development time, but they were originally an afterthought - I don't post a lot of RPG content, but I do still read tabletop RPG blogs and often see die roll tables simply listed out. While being able to read all the entries is valuable, an interactive roller makes nested tables easier to follow, and at the table being able to roll quickly is even better. I'd be delighted if this were useful to anyone making tables regularly.

For myself, I imagine using Shesha as a library to develop generators like those I used in old chargen bots like @ArkhamSingles. The embeddable framework means I don't have to deal with setting up a Twitter bot or worry about API changes or limitations, I can just jot something down and post it.

Similar Work

Before working on Shesha I knew of several somewhat-similar projects, and after writing it I found several more poking around. You can see a full list on Github. Two particularly worth a look are Tracery and Perchance.

The Name

The name comes from Shesha, the King of the Nagas. Though the universe is created and destroyed repeatedly, he remains between each iteration. It seemed a natural match.

Going Forward

At this point Shesha has most of the features I originally planned for it, and while rough around the edges it's a good environment for me to write generators in. Since I'd rather spend time writing generators than writing a generator toolkit, there shouldn't be any dramatic developments in the near future.

That said, if you have any suggestions or if you've found Shesha useful, I'd be glad to hear about it over on Github. Ψ