Generating random integers in the range x - y (postgres)

-- Generate the randon integer (to generate a float just take off the trunc function) select trunc(random() * y + x) -- Testing the distribution measuring the frequency for each number select trunc(random() * y + x) as random_number, count(*) as frequency from generate_series(1,10000) group by random_number order by random_number;
How to generate and how to measure the distribution to the random number generator used by postgres.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.