"Random" in TW -- Practical Issues & Q's

If you want an example wiki using precisely this technique, you can investigate my Bullshit Bingo wiki.

We have a startup action, $:/_/bb/actions/choose-random that uses a pseudo-random number generator to pick an initial seed value for the wiki and stores it in a temporary value, that is then picked up as the first of my $:/DefaultTiddlers. It will be something like Card_561 or Card_42. These are virtual tiddlers whose entire content is derived from the numeric id via a template that uses a module that (for some reason lost to fading memory) contains another copy of that same randomizer.

The important point is that these are repeatable pseudo-random numbers. Called with the same seed, they will report the same sequence of random-enough values on every use.

The trick here to escape the issue @pmario describes is to start the wiki off with randomizing seed values for anything you want to be static across the visit. In my case, it’s just the default tiddler than I need to initialize, but the same thing should work fine for dozens or hundreds of things that need randomization. And if you can associate a number with your values, you don’t need to do anything up front: just use that number as a seed, as I do with the card numbers.

And hey, while you’re there, if you have suggestions for snarky definitions of my still-to-be-defined terms, feel free to share! :slight_smile:

2 Likes