uint64_t
random64(void)
{
v ^= (v>>21);
v ^= (v<<35);
v ^= (v>>4);
return v + 2685821657736338717LL;
}
uint64_t
random64(void)
{
v ^= (v>>21);
v ^= (v<<35);
v ^= (v>>4);
return v + 2685821657736338717LL;
}
C is so much easier to use for math stuff.
Like for a tacho;
rpm = (60000000 / period_us);
is one easy line in C even though rpm and period_us are 16bit variables and all the math is done in 32bit. That takes a few seconds to type in C but is a rather nasty piece fo code to make in asm.
MisterT-
Where did you get that RNG code from? It looks poor, what is the point of adding a large prime number right at the end but not blending it in to the algorithm?You may as well just add "5" to the end result.
There is a RNG here that generates very good entropy from a simple algorithm although it is not particularly time efficient; The Black Random number generator
There is a RNG here that generates very good entropy from a simple algorithm although it is not particularly time efficient; The Black Random number generator
How do you (Mr RB) define "very good entropy"? Have you tested your Black RNG with some test algorithms like Diehard or the tests recommended by NIST? Also, you claim that the Black RNG generates pure random numbers that cannot be predicted.. How it is impossible to predict something that your algorithm just generated? And how is "unbreakable encryption" useful to anybody? Every encryption algorithm must have a method to decrypt the data, so by definition unbreakable encryption is impossible (or useless).
Sorry for the off-topic.
no but people do LOLComputers don't do "random",
I don't think Mr RB suggested the Black RNG was pure random, just that it had better entropy.
Yes he did. In the website he says: "My algorithm for generating pure entropic (random) data" and "After enough passes the data is completely random and cannot be predicted."
There is a RNG here that generates very good entropy from a simple algorithm although it is not particularly time efficient; The Black Random number generator
Optimizing compilers can compact code in ways that no rational human would. Optimized code can be smaller then hand coded assembly.
The RNG I posted (the code is missing the initialization) is from the book "Numerical Recipes - The Art of Scientific Computing, 3rd edition". In the book it says: "It has a period of “only” 1.8e19, so it should not
be used by an application that makes more than 10^12 calls. With that restriction, we think that it will do just fine for 99.99% of all user applications".
Computers don't do "random", I don't think Mr RB suggested the Black RNG was pure random, just that it had better entropy.
To predict the next number generated you would need to know the entire contents of the 1Mbit cache, and the postion in the cache, and the state of the RNG engine. It is not possible for the observer to know those things based on previously generated numbers, so to predict means you must solve for every possible solution of cache content and cache index and engine values, and that brings you back to equal odds, ie your chance of guessing.How it is impossible to predict something that your algorithm just generated?
"Pure" random is in the eye of the beholder. Any process that produces a new number that cannot be predicted by knowing all the numbers before it meets my definition of random.
The result is *sufficiently* random that the next number in the sequence can't be predicted by the observer.
MisterT- To predict the next number generated you would need to know the entire contents of the 1Mbit cache, and the postion in the cache, and the state of the RNG engine. It is not possible for the observer to know those things based on previously generated numbers, so to predict means you must solve for every possible solution of cache content and cache index and engine values, and that brings you back to equal odds, ie your chance of guessing.
It doesn't take long to code my RNG engine up in C, feel free to play with it and run the data through your tests. Or use it in your commercial product, I don't care. It won't do the really fast megabits/sec RN generation you asked for in your other thread but it is sufficiently random with enough passes, if you need high quality RNG generated solely by algorithm without resorting to hardware tricks.
After giving you all of my 100 random numbers I will choose a new set of numbers - from 100 to 199. I will shuffle them and give them to you in a random order. There is no way you can predict the next number for sure.. etc.
Does that satisfy your need for a good RNG?
If the RNG I have used is good enough to produce millions and millions of uniformly distributed coordinates around the globe, I should have a very good answer after millions and millions of random coordinates sent. I really don't want the random numbers clustering around atlantic.. or missing the river Kwai. The millions and millions and millions of points really have to be uniformly distributed around the globe.
Can you say that your Black RNG is *sufficiently* random to give me a good results in a situation like that?
Some RNGs have trouble recovering after generating a small number. I'm not saying that this is the case with Black RNG, but it is a flaw with some RNGs. If some poor RNG produces a small number, I can predict that couple of next numbers will also be small. Are you sure that Black RNG does not have this kind of flaws?
The reason I'm giving you (Mr RB) a hard time with this is that there is a need for a really good random number generators. I want to know if Black RNG is really as good as the hype you are putting out.
No. Shuffling a set list of numbers is nowhere near random. You get exactly 1 of each number per 100 samples, giving you enormous leverage to predict the next number by knowing the previous numbers, like counting cards.
Also your idea of taking from different sets [0,99], [100,199] isn't random. A random number has an equal chance of getting picked from a set as any other number in this set at any given instance, you are giving every other set a 0% chance.
Also, stop leeching off this thread.
With the seed info and the number of steps you can predict the next number with the algorithm.
I'll refine that further for MisterT; "The next number has an equal probability of being any number" - which I thought was obvious from the fact that it can't be predicted.
While not an expert in random number theory I know enough to see that most of this thread is more speculation then science.
We have access to tests used to quantify the random/non randomness of number sets. Either Mr T or yourself can run these tests and be done with it.
They can be very good but because it's an algorithm and not infinite ...
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?