Linux on older Macs
I've tried a couple different PowerPC Linux distributions on older PPC Macs. As I recall, in every case there was something broken or missing: WiFi, sleep, sound, etc. Perhaps things have improved in recent times.
A simple PRNG using /dev/urandom
Moderator: Ras
-
matthewlai
- Posts: 793
- Joined: Sun Aug 03, 2014 4:48 am
- Location: London, UK
Re: Linux on older Macs
That sounds a little strange, since Macs are the most common PPC computers out there (for desktop Linux at least), you would think they would be well tested.sje wrote:Linux on older Macs
I've tried a couple different PowerPC Linux distributions on older PPC Macs. As I recall, in every case there was something broken or missing: WiFi, sleep, sound, etc. Perhaps things have improved in recent times.
Disclosure: I work for DeepMind on the AlphaZero project, but everything I say here is personal opinion and does not reflect the views of DeepMind / Alphabet.
-
sje
- Posts: 4675
- Joined: Mon Mar 13, 2006 7:43 pm
Ten million random games
Ten million random games generated in 56 minutes:
Code: Select all
[] rg 10000000
checkmate 1529145 0.152915
fiftymoves 1933690 0.193369
insufficient 5673175 0.567318
repetition 252856 0.0252856
stalemate 611134 0.0611134
Average ply length: 334.401
Maximum ply length: 937
PT: 3:32:49.600
WT: 56:08.881-
sje
- Posts: 4675
- Joined: Mon Mar 13, 2006 7:43 pm
Code thief
I stole it.mar wrote:Very nice solution for uniform distribution. Your own?Code: Select all
const ui range = -bound % bound; ui next = NextDwrd(); while (next < range) next = NextDwrd(); pick = next % bound; }
I prefer modulo-free but I find this very elegant because you can change range on the fly.
Search the web for "modulus bias" and you'll see similar code in many places.
-
hMx
- Posts: 61
- Joined: Wed Mar 08, 2006 9:40 pm
- Location: Germany, Berlin
Re: A simple PRNG using /dev/urandom
This very much looks like a RNG, without any pseudo. What do I miss?sje wrote:Here's some C++ source code for a PRNG (pseudorandom number generator) which uses guarded access to the kernel's /dev/urandom device.
-
matthewlai
- Posts: 793
- Joined: Sun Aug 03, 2014 4:48 am
- Location: London, UK
Re: A simple PRNG using /dev/urandom
/dev/random and /dev/urandom are PRNG. They take environmental noise (or hardware RNG output), and do some math with it to make a pseudo-random stream with the desired distribution.hMx wrote:This very much looks like a RNG, without any pseudo. What do I miss?sje wrote:Here's some C++ source code for a PRNG (pseudorandom number generator) which uses guarded access to the kernel's /dev/urandom device.
Disclosure: I work for DeepMind on the AlphaZero project, but everything I say here is personal opinion and does not reflect the views of DeepMind / Alphabet.
-
AlvaroBegue
- Posts: 932
- Joined: Tue Mar 09, 2010 3:46 pm
- Location: New York
- Full name: Álvaro Begué (RuyDos)
Re: A simple PRNG using /dev/urandom
Well, we are down to definitions, but I generally expect to be able to reproduce what my program did if I am careful to seed the PRNG appropriately. This won't work with /dev/urandom. For that reason alone, I would much rather use a standard PRNG without any pesky entropy getting in the way.matthewlai wrote:/dev/random and /dev/urandom are PRNG. They take environmental noise (or hardware RNG output), and do some math with it to make a pseudo-random stream with the desired distribution.hMx wrote:This very much looks like a RNG, without any pseudo. What do I miss?sje wrote:Here's some C++ source code for a PRNG (pseudorandom number generator) which uses guarded access to the kernel's /dev/urandom device.
-
matthewlai
- Posts: 793
- Joined: Sun Aug 03, 2014 4:48 am
- Location: London, UK
Re: A simple PRNG using /dev/urandom
I also almost always use pure PRNG. /dev/urandom is really only beneficial for cryptographic applications.AlvaroBegue wrote:Well, we are down to definitions, but I generally expect to be able to reproduce what my program did if I am careful to seed the PRNG appropriately. This won't work with /dev/urandom. For that reason alone, I would much rather use a standard PRNG without any pesky entropy getting in the way.matthewlai wrote:/dev/random and /dev/urandom are PRNG. They take environmental noise (or hardware RNG output), and do some math with it to make a pseudo-random stream with the desired distribution.hMx wrote:This very much looks like a RNG, without any pseudo. What do I miss?sje wrote:Here's some C++ source code for a PRNG (pseudorandom number generator) which uses guarded access to the kernel's /dev/urandom device.
Disclosure: I work for DeepMind on the AlphaZero project, but everything I say here is personal opinion and does not reflect the views of DeepMind / Alphabet.
-
bob
- Posts: 20943
- Joined: Mon Feb 27, 2006 7:30 pm
- Location: Birmingham, AL
Re: Sample timings
There is another problem. /dev/random and cousins are slow. All the hysteresis data takes time to gather, and once you exhaust what is there, you get ti wait while more is collected. Better might be a simple linear congruential PRNG where you use /dev/random to seed it, then call it 10K times, and re-seed. This prevents any short cycles from showing up and beats on the kernel much less...
-
bob
- Posts: 20943
- Joined: Mon Feb 27, 2006 7:30 pm
- Location: Birmingham, AL
Re: Linux on older Macs
"How much do you know about apple?"matthewlai wrote:That sounds a little strange, since Macs are the most common PPC computers out there (for desktop Linux at least), you would think they would be well tested.sje wrote:Linux on older Macs
I've tried a couple different PowerPC Linux distributions on older PPC Macs. As I recall, in every case there was something broken or missing: WiFi, sleep, sound, etc. Perhaps things have improved in recent times.