dojox/math/random/Secure (version 1.10)

Summary

Super simple implementation of a random number generator, which relies on Math.random().

Usage

var foo = new Secure(prng,noEvents);
dojox/math/random/Secure
Parameter Type Description
prng Function

function that returns an instance of PRNG (pseudo random number generator) with two methods: init(array) and next(). It should have a property "size" to indicate the required pool size.

noEvents Boolean
Optional

if false or absent, onclick and onkeypress event will be used to add "randomness", otherwise events will not be used.

Method Summary

  • _seed_int(x) Mix in a 32-bit integer into the pool
  • destroy() Disconnects events, if any, preparing the object for GC.
  • nextBytes(byteArray) Fills in an array of bytes with random numbers
  • seedTime() Mix in the current time (w/milliseconds) into the pool

Methods

_seed_int(x)

Mix in a 32-bit integer into the pool

Parameter Type Description
x undefined
destroy()

Disconnects events, if any, preparing the object for GC.

nextBytes(byteArray)

Fills in an array of bytes with random numbers

Parameter Type Description
byteArray Array

array to be filled in with random numbers, only existing elements will be filled.

seedTime()

Mix in the current time (w/milliseconds) into the pool

Error in the documentation? Can’t find what you are looking for? Let us know!