davidbau / seedrandom

seeded random number generator for Javascript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom integral number type support

kripod opened this issue · comments

Add the following methods to seedrandom:

  • .int(bytes = 4, unsigned = false, min = 0, max = 256 ** bytes - 1)
  • .int8(min = -128, max = 127)
  • .uint8(min = 0, max = 255)
  • .int16(min = -32768, max = 32767)
  • .uint16(min = 0, max = 65535)
  • .uint32(min = 0, max = 4294967295)

(Same comment)

We probably supply too many forms already, which might be justified because some of the forms are faster than others and so provide more "native" access to the underlying PRNG.

However, in the spirit of keeping this library as small as possible, we should consider convenience functions "out of scope" - there are a large number of convenience functions that should be supplied by a full random number library: uniform, normal, exponential, integer ranges, shuffles, etc. But that's not the purpose of this small library.

We just provide raw access to a PRNG source and leave it to other libraries to supply more specific distributions.