1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const tslib_1 = require("tslib");
|
4 | const long_1 = tslib_1.__importDefault(require("long"));
|
5 | class RandomIntGenerator {
|
6 |
|
7 |
|
8 |
|
9 | static getAttemptId() {
|
10 | const sysTime = long_1.default.fromNumber(Date.now()).shiftLeft(22);
|
11 | const randomBit = long_1.default.fromNumber(RandomIntGenerator.generate() & 4194303).and(long_1.default.MAX_VALUE);
|
12 | return sysTime.or(randomBit);
|
13 | }
|
14 | static generate() {
|
15 | return Math.floor(Math.random() * Math.floor(Number.MAX_SAFE_INTEGER));
|
16 | }
|
17 | }
|
18 | exports.default = RandomIntGenerator;
|
19 |
|
\ | No newline at end of file |