Remix.run Logo
▲ ubutler an hour ago

Rule #1 of rolling your own RNG: don’t.

Rule #2? Please don’t.

▲j16sdiz an hour ago | parent [-]

That's why we use the system RNG !

▲flanz_10 36 minutes ago | parent | next [-]

btw, the idea that the system rng isnt good enough, or "runs out" or whatever, is no longer true on pretty much every modern, widely used os.

btw... im sure there's some legacy rng in windows or some shit that isnt good. read the docs but if it's the blessed system rng, you're probably fine!

although... i suppose if this is news to you (the person reading this), then you probably shouldn't be implementing whatever you are that really requires prng. ask a friend for help. im not trying to be a jerk, i just want to make sure you dont hurt yourself!

▲cowlevel 18 minutes ago | parent | prev [-]

Be careful to use the cryptographic one, not rand(3)

And if you're a sysadmin, be extremely careful when generating keys in VMs or embedded devices.