@xtia/alea-rc 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/internal/alea.d.ts +1 -1
- package/internal/alea.js +1 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ Alea is a utility wrapper for turning random numbers into useful values. Give it
|
|
|
7
7
|
* Fully typed
|
|
8
8
|
* Crypto-safe and seeded algorithms out-of-the-box
|
|
9
9
|
* No dependencies
|
|
10
|
-
* ~2.
|
|
10
|
+
* ~2.3kb minified
|
|
11
11
|
* Ranged int, array shuffling, dice roll, weighted sampling, phrase generation, uuid, bytes and many more
|
|
12
12
|
|
|
13
13
|
## Brief:
|
package/internal/alea.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ export declare class Alea {
|
|
|
53
53
|
* @param charset
|
|
54
54
|
* @returns Generated string
|
|
55
55
|
*/
|
|
56
|
-
string(length: number, charset
|
|
56
|
+
string(length: number, charset: string): string;
|
|
57
57
|
/**
|
|
58
58
|
* Generates a phrase from a table and a root string
|
|
59
59
|
* @example
|
package/internal/alea.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { charsets } from "./util";
|
|
2
1
|
export class Alea {
|
|
3
2
|
/**
|
|
4
3
|
* @param next Source RNG - a function that returns a value >= 0 and < 1
|
|
@@ -75,7 +74,7 @@ export class Alea {
|
|
|
75
74
|
* @param charset
|
|
76
75
|
* @returns Generated string
|
|
77
76
|
*/
|
|
78
|
-
string(length, charset
|
|
77
|
+
string(length, charset) {
|
|
79
78
|
if (!Number.isInteger(length) || length < 0)
|
|
80
79
|
throw new RangeError("length must be a non-negative integer");
|
|
81
80
|
if (!charset || charset.length === 0)
|