Timeline for Transforming Gaussian random $[0,1] $ numbers to uniform $[0,255] $
Current License: CC BY-SA 3.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 12, 2015 at 11:15 | vote | accept | dylan7 | ||
Aug 5, 2015 at 23:58 | comment | added | dylan7 | @Ilmari Karonen I posted the distribution from the generator in my original post. I also posted the result from my original method. I tried the method proposed in user Chris 's answer which did not result in a uniform distribution among the bytes. However, my method did. But with my method I tested it with Matlab's entropy() function which produced a very low number (.034...). However, this function in Matlab seems incorrect since it produces a higher entropy for a normal distribution.The method I proposed seems to be producing what appears to be close to a uniform distribution. | |
Aug 2, 2015 at 19:33 | history | edited | Chris | CC BY-SA 3.0 |
fixed grammar + added information
|
Aug 2, 2015 at 17:58 | comment | added | Ilmari Karonen | @dylan7: If the two values are equal, you'll need to discard them both, and get two new values. Basically, you're taking in two random values A and B (from any distribution) and returning either 1 (if A > B), 0 (if A < B) or no value (if A = B). Otherwise, you may end up with biased results. For reference, this is basically a variant of von Neumann whitening, extended to non-binary input distributions. | |
Aug 2, 2015 at 16:27 | comment | added | dylan7 | @Ilmari Karonen Ah, that makes sense now, so I could just compare adjacent values in my generated sample (discard both after comparison) and if two are equal find a third and compare both them to that third number and discard all three? | |
Aug 2, 2015 at 15:41 | comment | added | Ilmari Karonen | @dylan7: Ah, no. You don't need the mean for anything. What Chris is saying is that you should take two random values, and see which one is greater. Assuming that they're independent and identically distributed, and that they don't happen to be equal, that will give you one unbiased bit. Then take two more values and compare them to get another bit, and so on. | |
Aug 2, 2015 at 15:04 | comment | added | dylan7 | @Ilmari Karonen Thank you. I will try it with my TRNG and see if there is a difference. So I was using the mean of the distribution for comparison. When I come to the mean I get $A=B $, when you say repeat the process do I choose another number to compare the mean to and then compare all subsequent values to that new number until $A=B $ again? | |
Aug 2, 2015 at 14:56 | comment | added | Ilmari Karonen | @dylan7: You may have just demonstrated that your pseudo-RNG isn't as random as you think it is. In fact, serial correlation between successive samples is a common flaw in popular LCRNGs. | |
Aug 2, 2015 at 14:46 | comment | added | Ilmari Karonen | Note that, for this method to really generate unbiased bits, you'll have to discard both $A$ and $B$ and repeat the process if $A=B$. In fact, such rejection sampling is unavoidable in general: for input distributions having less than 0.5 bits of entropy, there's no way to get an unbiased output bit without sometimes consuming more than two input samples. Also note that this scheme relies on the samples being independent; if subsequent samples may be linked (as they, inevitably, are for PRNGs; good PRNGs try to hide this dependence, more or less successfully), the output can easily be biased. | |
Aug 2, 2015 at 14:46 | comment | added | dylan7 | As I said above in my commrnt to the prevoous answer, I tested that with a normal pseudo rng, and a histogram of the bytes produced a distribution far from uniform. Are the bits themselves only suppose to be uniformly distributed ? | |
Aug 2, 2015 at 4:56 | history | answered | Chris | CC BY-SA 3.0 |