Skip to Content
๐ŸŽฒ Welcome to RandBox - Powerful JavaScript Random Data Generation Library! Learn More
blogRandBox Module Tour (5/12): miscellaneous โ€“ Probability and IDs

RandBox Module Tour (5/12): miscellaneous โ€“ Probability and IDs

Overview

  • Probability & weights: coin/weighted/radio
  • Distributions & rules: normal, dice/rpg/tv
  • IDs & uniqueness: guid/hash/unique, fileWithContent

Examples

import RandBox from 'randbox' const rb = new RandBox() const side = rb.coin?.() const val = rb.normal?.({ mean: 0, stdev: 1 }) const uid = rb.guid?.()

Links

  • Index: /en/docs/miscellaneous/
  • Pages: /en/docs/miscellaneous/weighted, /en/docs/miscellaneous/unique

FAQ

  • How are weights normalized?
    • Converted to probabilities summing to 1.
  • Which method for normal distribution?
    • Commonly Boxโ€“Muller or Ziggurat.
Last updated on: