(ip: string)
| 75 | const pick = <T>(arr: T[]): T => arr[Math.floor(Math.random() * arr.length)]!; |
| 76 | |
| 77 | function randomProps(ip: string): Record<string, unknown> { |
| 78 | const props: Record<string, unknown> = { __ip: ip }; |
| 79 | const n = Math.floor(Math.random() * 4); // 0–3 extra properties |
| 80 | for (let k = 0; k < n; k++) { |
| 81 | props[`prop_${pick(WORDS)}`] = |
| 82 | Math.random() < 0.5 ? pick(WORDS) : Math.floor(Math.random() * 1000); |
| 83 | } |
| 84 | return props; |
| 85 | } |
| 86 | |
| 87 | // One event in a session: the entry is always a screen_view; the rest are a |
| 88 | // 50/50 mix of more screen_views and random custom events. |
no test coverage detected