()
| 72 | ] |
| 73 | |
| 74 | function selectRandomMessage() { |
| 75 | const random = Math.random() * 100 |
| 76 | let cumulative = 0 |
| 77 | |
| 78 | for (const {type, weight} of MESSAGE_DISTRIBUTION) { |
| 79 | cumulative += weight |
| 80 | if (random < cumulative) { |
| 81 | const templates = MESSAGE_TEMPLATES[type] |
| 82 | return templates[Math.floor(Math.random() * templates.length)] |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | return MESSAGE_TEMPLATES.simple[0] |
| 87 | } |
| 88 | |
| 89 | function generateFileContent(fileIndex) { |
| 90 | const numMessages = Math.floor(Math.random() * 10) + 5 // 5-15 messages per file |
no test coverage detected