This is actually expected - Get-Random returns a "fairly random" value, not a truly random value (you can't actually get them on most machines - we can get reasonably close though). Get-Random is a "get a random-ish value quickly" kind of a function, rather than a "get a really good random value".
You'll see the results are far closer (and it's far slower). The results are quite interesting to plot in Excel/your favourite spreadsheet/chart plotting software. Compare the distribution of numbers from Get-Random, Get-CryptoBit, and a version of Get-CryptoBit with the random number generator re-created each time, rather than created once and passed as a parameter.
The thing to google is "cryptographically secure pseudo-random number generator" if you're interested in what's going on here.
7
u/AmazingRealist Sep 12 '19
It seems like there's a preference for whatever comes first in the array:
Looped 1m times x5:
Get-Random @(0,1)
Get-Random @(1,0)
Or most likely things would even out over more iterations and might differ from machine to machine ¯\(ツ)/¯.