Procedurally generates a radio weather report

replace Math.random() with crypto.randomInt()

Changed files
+3 -3
src
test
+2 -1
src/sequencer.ts
··· 2 2 import { voiceLines } from './voice.js'; 3 3 import type { Config } from './index.js'; 4 4 import type { Voice } from './voice.js'; 5 + import crypto from 'crypto'; 5 6 6 7 type SegmentName = string; 7 8 type SequenceName = string; ··· 16 17 let config: Config = null; 17 18 18 19 function selectOne<T>(arr: T[]): T { 19 - return arr[Math.floor(Math.random() * arr.length)]; 20 + return arr[crypto.randomInt(0, arr.length)]; 20 21 } 21 22 22 23 function resolveSide(side: string, currentWeather: DailyWeather) {
+1 -2
test/sequencer.test.ts
··· 1 1 import { describe, expect, it, vi } from 'vitest'; 2 - import { type CurrentWeather, type Options } from 'openweather-api-node'; 2 + import { type Options } from 'openweather-api-node'; 3 3 import { Sequencer } from '../src/sequencer.js'; 4 - import type { Config } from '../src/index.js'; 5 4 6 5 const dummyWeather: Options = { key: 'dummy' }; 7 6