An extremely useful repeatable random data generator.

Based on Nonsense by Josh Faul https://github.com/jocafa/Nonsense.

The random number genererator is based on the Alea PRNG, but is modified.

- https://github.com/coverslide/node-alea
- https://github.com/nquinlan/better-random-numbers-for-javascript-mirror
- http://baagoe.org/en/wiki/Better_random_numbers_for_javascript (original, perm. 404)

Name | Type | Argument | Description |
---|---|---|---|

`seeds` | Array.<any> | string | <optional> | An array of values to use as the seed, or a generator state (from {#state}). |

- Source code: math/RandomDataGenerator.js (Line 23)

- Source code: math/RandomDataGenerator.js (Line 310)
- Source code: math/RandomDataGenerator.js (Line 198)
- Source code: math/RandomDataGenerator.js (Line 160)
- Source code: math/RandomDataGenerator.js (Line 148)
- Source code: math/RandomDataGenerator.js (Line 184)
- Source code: math/RandomDataGenerator.js (Line 227)
- Source code: math/RandomDataGenerator.js (Line 258)
- Source code: math/RandomDataGenerator.js (Line 172)
- Source code: math/RandomDataGenerator.js (Line 213)
- Source code: math/RandomDataGenerator.js (Line 271)
- Source code: math/RandomDataGenerator.js (Line 83)
- Source code: math/RandomDataGenerator.js (Line 322)
- Source code: math/RandomDataGenerator.js (Line 296)
- Source code: math/RandomDataGenerator.js (Line 239)
- Source code: math/RandomDataGenerator.js (Line 283)

Returns a random angle between -180 and 180.

number -

A random number between -180 and 180.

Returns a random integer between and including min and max.

This method is an alias for RandomDataGenerator.integerInRange.

Name | Type | Description |
---|---|---|

`min` | number | The minimum value in the range. |

`max` | number | The maximum value in the range. |

number -

A random number between min and max.

Returns a random real number between 0 and 1.

number -

A random real number between 0 and 1.

Returns a random integer between 0 and 2^32.

number -

A random integer between 0 and 2^32.

Returns a random integer between and including min and max.

Name | Type | Description |
---|---|---|

`min` | number | The minimum value in the range. |

`max` | number | The maximum value in the range. |

number -

A random number between min and max.

Returns a random real number between -1 and 1.

number -

A random real number between -1 and 1.

Returns a random member of `array`

.

Name | Type | Description |
---|---|---|

`ary` | Array | An Array to pick a random member of. |

any -

A random member of the array.

Returns a random real number between 0 and 2^32.

number -

A random real number between 0 and 2^32.

Returns a random real number between min and max.

Name | Type | Description |
---|---|---|

`min` | number | The minimum value in the range. |

`max` | number | The maximum value in the range. |

number -

A random number between min and max.

Returns a sign to be used with multiplication operator.

number -

-1 or +1.

Reset the seed of the random data generator.

*Note*: the seed array is only processed up to the first `undefined`

(or `null`

) value, should such be present.

Name | Type | Description |
---|---|---|

`seeds` | Array.<any> | The array of seeds: the |

Gets or Sets the state of the generator. This allows you to retain the values

that the generator is using between games, i.e. in a game save file.

To seed this generator with a previously saved state you can pass it as the`seed`

value in your game config, or call this method directly after Phaser has booted.

Call this method with no parameters to return the current state.

If providing a state it should match the same format that this method

returns, which is a string with a header `!rnd`

followed by the `c`

,`s0`

, `s1`

and `s2`

values respectively, each comma-delimited.

Name | Type | Argument | Description |
---|---|---|---|

`state` | string | <optional> | Generator state to be set. |

string -

The current state of the generator.

Returns a random timestamp between min and max, or between the beginning of 2000 and the end of 2020 if min and max aren't specified.

Name | Type | Description |
---|---|---|

`min` | number | The minimum value in the range. |

`max` | number | The maximum value in the range. |

number -

A random timestamp between min and max.

Returns a valid RFC4122 version4 ID hex string from https://gist.github.com/1308368

string -

A valid RFC4122 version4 ID hex string

Returns a random member of `array`

, favoring the earlier entries.

Name | Type | Description |
---|---|---|

`ary` | Array | An Array to pick a random member of. |

any -

A random member of the array.

© 2016 Richard Davey, Photon Storm Ltd.

Licensed under the MIT License.

http://phaser.io/docs/2.6.2/Phaser.RandomDataGenerator.html