1.2.1 • Published 9 years ago

vz.rand v1.2.1

Weekly downloads
3
License
LGPL-3.0
Repository
github
Last release
9 years ago

DEPRECATED in favour of u-rand

vz rand

Sample usage:

var rand = require('vz.rand');

rand(5);                  // Integer in the interval [0,5)
rand(0,6);                // Integer in the interval [0,6)
rand(0,6,true);           // Float in the interval [0,6)
rand.string(20);          // String of 20 characters, combination of 0-9a-z
rand.string(20,true);     // Same as above, but including date information
rand.string(20,62);       // String of 20 characters, combination of 0-9a-zA-Z
rand.string(20,62,true);  // Same as above, but including date information

Reference

rand(start,end)

Returns a random number starting at start, up to, but not including, end. Unless dontTruncate is present and true, integers are returned. If end is not specified, and start is positive, start is treated as end and 0 is treated as start. If it's negative, 0 is treated as end.

rand.string(n,base)

Returns a random string of length n, using up to base different characters - 36 by default - and including a timestamp if useDate evals to true.

1.2.1

9 years ago

1.2.0

10 years ago

1.1.0

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago