Assuming there is bytes in the system's entropy pool, you can also skip the 
scrambling step, though I don't know what overhead consuming these bytes 
entails compared to a standard PRNG. Then the biggest part of it is making 
the raw bytes into float. I'm not sure - could you take 4 random bytes, 
grab the unsafe pointer and cast back to float32?

On Tuesday, 26 February 2019 00:16:20 UTC+1, Rob 'Commander' Pike wrote:
>
> If you don't need precision, just generate ints and scale them.
>
> -rob
>
>
> On Tue, Feb 26, 2019 at 9:39 AM DrGo <salah....@gmail.com <javascript:>> 
> wrote:
>
>> Thanks Ian,
>> The std lib float32 is slow for my purpose. In my benchmarking it is 
>> actually slower than the float64. But I don’t even need float16 precision.
>> I am working on implementing othe alias method for sampling from a fixed 
>> freq dist with possibly thousands of arbitrary values. So the rng doesn’t 
>> need to be precise or high quality because of rounding eg a rn of .67895 
>> might end up selecting the same arbitrary value as .67091 or even .65!!
>> https://en.m.wikipedia.org/wiki/Alias_method
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golang-nuts...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to