5623b11Recorder simulator: MATLAB jet-drive model and interactive web appJeremy Magland 1function [r, state] = recorder_rng(state, n)
2% RECORDER_RNG Portable seeded uniform generator (32-bit LCG).
3% Returns n uniforms in (0, 1) as a column vector, plus the advanced state.
4% Deliberately not MATLAB's rand: the same seed must produce the identical
5% breath noise in the numbl CLI, Node, and the browser, and every double
6% here stays below 2^53 so the arithmetic is exact everywhere.
7r = zeros(n, 1);
8for i = 1:n
9 state = mod(state * 1664525 + 1013904223, 4294967296);
10 r(i) = (state + 0.5) / 4294967296;
11end
12end