@miso.ai/lorem 0.10.0-beta.0 → 0.10.0-beta.1
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/lib/index.js +1 -1
- package/lib/lorem.js +2 -1
- package/lib/prng.js +5 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
package/lib/lorem.js
CHANGED
|
@@ -3,6 +3,7 @@ import { Words } from './words.js';
|
|
|
3
3
|
import { Markdown } from './markdown.js';
|
|
4
4
|
import { Fields } from './fields.js';
|
|
5
5
|
import { Utils } from './utils.js';
|
|
6
|
+
import { randomSeed } from './prng.js';
|
|
6
7
|
|
|
7
8
|
export function lorem(options) {
|
|
8
9
|
return new Lorem(options);
|
|
@@ -10,7 +11,7 @@ export function lorem(options) {
|
|
|
10
11
|
|
|
11
12
|
class Lorem {
|
|
12
13
|
|
|
13
|
-
constructor({ seed } = {}) {
|
|
14
|
+
constructor({ seed = randomSeed() } = {}) {
|
|
14
15
|
this._seed = seed;
|
|
15
16
|
this._prng = prng({ seed });
|
|
16
17
|
|
package/lib/prng.js
CHANGED
|
@@ -20,6 +20,10 @@ class PRNG {
|
|
|
20
20
|
return (this.random() + this.random() + this.random()) * 2 - 3;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
seed() {
|
|
24
|
+
return this.random() * 0x100000000 >>> 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
23
27
|
uuid() {
|
|
24
28
|
return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, a => (a ^ this.random() * 16 >> a / 4).toString(16));
|
|
25
29
|
}
|
|
@@ -52,7 +56,7 @@ function rotl(x, k) {
|
|
|
52
56
|
return ((x << k) | (x >>> (32 - k))) >>> 0;
|
|
53
57
|
}
|
|
54
58
|
|
|
55
|
-
function randomSeed() {
|
|
59
|
+
export function randomSeed() {
|
|
56
60
|
return Math.random() * 0x100000000 >>> 0;
|
|
57
61
|
}
|
|
58
62
|
|
package/package.json
CHANGED