Random number generation with (close to) even distribution within range

In working with Random, it seems to be biased toward generating values in the middle of the range rather than the extremes.

example: I’m asking Random to generate 12000 values within a range from 0-4 and there are about half as many 0’s and 4’s as there are 1,2,3

Thoughts on the most simple way to get random values that are more evenly distributed across a range?

The alternative that I am currently using is to generate a list of values with the desired distribution and using the shuffle component to randomize their location in the list.

I would still like to better understand the distribution issue that I am having with the random component.

I think that is because of rounding.

0-0.5 are counted as 0,
0.5-1.5 are counted as 1,
1.5-2.5 -> 2
2.5-3.5 -> 3
3.5-4 -> 4
maybe random from 0 to 5 with 2 decimal places and floor the rounding?
Although if you look at it, the 1500 changes between the different seeds.

Yeah it is indeed a rounding problem, but I couldn’t fix it without breaking existing files.

I’m afraid you’ll need to set the domain to -/+ half of the integer range.

This is very helpful - thank you!

@christopher.ho and @DavidRutten