Skip to content

Commit

Permalink
Mention the existence of Random
Browse files Browse the repository at this point in the history
And say a bit about how and when to use
  • Loading branch information
simonra committed Jul 13, 2019
1 parent 4323c13 commit ac28185
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,23 @@ Sometimes you want to squeeze in a new scene between two other scenes that you a
Often you will perhaps only shorten the preceding scene and leave the start of the following scene intact.
But for completeness, here is an example where we both shorten the previous scene, and chop down the beginning of the following scene.

### Randomness

To ensure that random things happen consistently across runs it is recommended to use the `Random`-class rather than `Math.random()`.
Set up `Random` by initializing it in your constructor like so:
```
constructor(id, options) {
...
this.random = new Random('seedString');
...
}
```

Then use the random generator you just created like this:
```
var randomNumber = this.random();
```

### Time and timed events

A lot of making a demo is syncing what's happening on the screen with the music.
Expand Down

0 comments on commit ac28185

Please sign in to comment.