JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1509
  • Score
    100M100P100Q115835F
  • License BSD-2-Clause

Meteor's Random Package for Straight Node – with built in crypto module

Package Exports

  • meteor-random-node

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (meteor-random-node) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

meteor-random-node

Meteor's Random Package, Stripped for Straight Node

  Random = require('meteor-random-node');

The random package provides several functions for generating random numbers. It uses a cryptographically strong pseudorandom number generator when possible, but falls back to a weaker random number generator when cryptographically strong randomness is not available (on older browsers or on servers that don't have enough entropy to seed the cryptographically strong generator).

  • Random.id([n]) Returns a unique identifier, such as "Jjwjg6gouWLXhMGKW", that is likely to be unique in the whole world. The optional argument n specifies the length of the identifier in characters and defaults to 17.

  • Random.secret([n]) Returns a random string of printable characters with 6 bits of entropy per character. The optional argument n specifies the length of the secret string and defaults to 43 characters, or 256 bits of entropy. Use Random.secret for security-critical secrets that are intended for machine, rather than human, consumption.

  • Random.fraction() Returns a number between 0 and 1, like Math.random.

  • Random.choice(arrayOrString) Returns a random element of the given array or string.

  • Random.hexString(n) Returns a random string of n hexadecimal digits.

For more information see Meteor's Random Docs