this repo has no description
1import type { Random as IRandom } from '@jet/environment';
2import { generateUuid } from '@amp/web-apps-utils';
3
4export class Random implements IRandom {
5 nextBoolean(): boolean {
6 // See: https://stashweb.sd.apple.com/projects/AS/repos/jet-infrastructure/browse/Frameworks/JetEngine/JetEngine/JavaScript/Stack/Native%20APIs/JSRandomObject.swift?at=e90a88fa061f5cb6b9536d29a7ffd67e5db942db#41
7 return Math.random() < 0.5;
8 }
9
10 nextNumber(): number {
11 // See: https://stashweb.sd.apple.com/projects/AS/repos/jet-infrastructure/browse/Frameworks/JetEngine/JetEngine/JavaScript/Stack/Native%20APIs/JSRandomObject.swift?at=e90a88fa061f5cb6b9536d29a7ffd67e5db942db#45
12 return Math.random();
13 }
14
15 nextUUID(): string {
16 return generateUuid();
17 }
18}