Skip to content

Commit

Permalink
docs: Improve random docs
Browse files Browse the repository at this point in the history
  • Loading branch information
eonarheim committed Sep 20, 2024
1 parent 30abd37 commit 0b905d0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions site/docs/09-math/07-random.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ You can instantiate the [[Random]] class with an optional seed number. You can
reuse this seed anytime to get the exact sequence of random numbers back. If no
seed is provided, it uses `Date.now()` ticks as the seed.

:::warning

Avoid creating multiple instances of `new ex.Random()`, if you create many in the same moment they will share the same `Date.now()` seed and will produce the same sequence of numbers.

It is recommended to create 1 instance of your seeded random and share it across your game.

:::

```ts
const rand = new ex.Random(1234)

Expand Down

0 comments on commit 0b905d0

Please sign in to comment.