seed = 12345; % Initial seed a = 1664525; % Multiplier c = 1013904223; % Increment n = 1000; % no of samples m = 2^32; x = zeros(1, n); random_numbers = zeros(1,n); x(1) = seed; for i = 1:n x(i+1) = mod(a * x(i) + c, m); % LCG formula random_numbers(i) = x(i+1) / m; % Normalize to [0,1) end figure; histogram(random_numbers, 50);