mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
35 lines
927 B
HTML
35 lines
927 B
HTML
<template name="pkg_random">
|
|
{{#better_markdown}}
|
|
## `random`
|
|
|
|
The `random` package provides several random-number utilities, using a
|
|
random-number generator whose implementation does not depend on the particular
|
|
browser.
|
|
|
|
<dl class="callbacks">
|
|
{{#dtdd "Random.id()"}}
|
|
Returns a unique identifier, such as `"Jjwjg6gouWLXhMGKW"`, that is likely to
|
|
be unique in the whole world.
|
|
{{/dtdd}}
|
|
|
|
{{#dtdd "Random.fraction()"}}
|
|
Returns a number between 0 and 1, like `Math.random`.
|
|
{{/dtdd}}
|
|
|
|
{{#dtdd "Random.choice(arrayOrString)"}}
|
|
Returns a random element of the given array or string.
|
|
{{/dtdd}}
|
|
|
|
{{#dtdd "Random.hexString(n)"}}
|
|
Returns a random string of `n` hexadecimal digits.
|
|
{{/dtdd}}
|
|
</dl>
|
|
|
|
{{#note}}
|
|
In the current implementation, random values do not come from a
|
|
cryptographically strong pseudorandom number generator. Future releases will
|
|
improve this, particularly on the server.
|
|
{{/note}}
|
|
{{/better_markdown}}
|
|
</template>
|