You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create an instance of the generator with your desired configuration:
@@ -37,6 +37,97 @@ The `config` object contains the following properties:
37
37
-`nonce` (number): The current nonce value.
38
38
-`cursor` (number): The current cursor value.
39
39
40
+
## Available methods
41
+
42
+
The Provable instance has the following methods:
43
+
44
+
### next(salt, clientSeed)
45
+
46
+
Returns an object containing the next `clientSeed` and `serverSeed` values based on the provided `salt` and `clientSeed` values. If `clientSeed` is not provided, it will be generated using the `md5` hashing function.
The generator's configuration is updated after generating the random numbers, and the `nonce` value is incremented. If an `emit` callback function is provided, it will be called with the updated configuration.
72
+
73
+
### ints(count, max, min)
74
+
75
+
Generates `count` number of random integer numbers within the range of `min` and `max` (inclusive) using the configured generator. The `count`, `max`, and `min` arguments are optional and default to `1`, `100`, and `0`, respectively.
The generator's configuration is updated after generating the random numbers, and the `nonce` value is incremented. If an `emit` callback function is provided, it will be called with the updated configuration.
83
+
84
+
### tick()
85
+
86
+
Increments the `nonce` value and emits the updated configuration (if an `emit` callback function is provided).
87
+
88
+
```javascript
89
+
generator.tick();
90
+
```
91
+
92
+
## Additional Generators
93
+
94
+
### HashSeries({ seed, salt, nonce })
95
+
96
+
This class is used to generate a series of hashes based on the provided `seed`, `salt`, and `nonce` values. It has the following methods:
97
+
98
+
-`getHash()`: Returns the current hash value.
99
+
-`next()`: Increments the `nonce` value and returns a new object with the updated `seed`, `salt`, and `nonce`.
100
+
-`peekHash()`: Returns the next hash value based on the updated `nonce` value.
101
+
-`calcHash(_seed, _salt, _nonce)`: Calculates the hash value using the provided `seed`, `salt`, and `nonce` values.
102
+
-`state()`: Returns an object containing the `seed`, `salt`, and `nonce` values.
0 commit comments