Home > @antv/dw-random > BasicRandom
Basic(bool int float regexp) Generater basic generator for bool int float regexp
Signature:
export declare class BasicRandom
Constructor | Modifiers | Description |
---|---|---|
(constructor)(seed) | Constructs a new instance of the BasicRandom class |
|
(constructor)(seed) | Constructs a new instance of the BasicRandom class |
Property | Modifiers | Type | Description |
---|---|---|---|
random | RandomFunc |
random的逻辑 生成 0-1之内的数字 可以使用 Math.random |
Method | Modifiers | Description |
---|---|---|
boolean(options) | Return a random boolean value (true or false). | |
float(options) | Genarate a float / double number | |
integer(options) | Reture a random integer | |
mixin(options) | static |
extends class's prototype |
n(generator, length, params) | Provide any function that generates random stuff (usually another generate function) and a number and n() will generate an array of items with a length matching the length you specified. | |
natural(options) | generate an integer number | |
pickone(array) | Given an array, pick a random element and return it | |
pickset(array, count) | Given an array, pick some random elements and return them in a new array | |
randexp(source, flag) | Generate a string which match regexp | |
shuffle(array) | (BETA) Given an array, scramble the order and return it. |