All of these things will involve some measure of scripting, depending on your needs. If you'd like to add a detailed RPG system to your story, that's completely feasible– but you (or a friend or two you recruit) will need to write the underpinnings of it yourself.
If you just would like to add a little randomness to your story, that's pretty simple. Here's an example of how you could write a passage that, every time it's visited, simulates a coin flip.
The referee reveals that the coin is (either:"heads","tails").
The referee reveals that the coin is <%= (Math.random() > 0.5) ? 'heads' : 'tails' %>.
The referee reveals that the coin is <<print either("heads","tails")>>.