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