English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 28 June 2010, 19:26   #21
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 3,307
Quote:
Dice don't have perfect surface or shape, and this makes some results to come out many more often than others. Any RPG (not computer) player should know this
I know a guy with a yellow transparent 20 sided dice. It was incredible but he often threw two or three 1 in a row. Also the judge has a black 20 sided dice often threws the 1. We all feared that littel black dice. Maybe only subjective perception ourselves.
daxb is offline  
Old 02 July 2010, 13:44   #22
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,350
Quote:
Originally Posted by Thorham View Post
Sure, but the pattern in which the numbers appear is still unpredictable, and you'll only be able to say that the chance that one number will show up will be higher than for a different number.
Of course i'm not able to say more than that, but it's enough to make it bad.

Quote:
Originally Posted by Thorham View Post
Partially. If you measure at every micro second, then you'll only get 20 bits, furthermore, humans click at a somewhat uniform rate. You don't take a second to click once, and the next time you take only a tenth of a second. This means that you'll likely end up with only 10 to 15 useful bits. And finally, because humans don't click that often, you end up with extremely little data. Not enough for certain applications.
But this "little data" is more than enough to generate an infinite sequence.

Quote:
Originally Posted by Thorham View Post
Although I certainly can't explain this, why would radio static be predictable anyway?
You're just reversing the question

Quote:
Originally Posted by Thorham View Post
Applications for which you need true random data, such as for gambling games where money is involved, for example. Hence the existence of hardware RNGs.
You'd probably be surprised to see how poor online gambling games are in that aspect...

Quote:
Originally Posted by Thorham View Post
No, only cryptographically strong PRNGs can be used for things such as encryption. There are quite a few very good PRGNs that are not cryptographically strong.
I have to see an example of this. All crypto code i've seen seemed to work well with relatively poor RNG.

Quote:
Originally Posted by Thorham View Post
Yes! The simple algorithm I came up with can benefit from such data. Those tables can be used for seeding. You can actually do all sorts of things with such data.
I didn't ask for some case where it is usable. I asked for one where it is needed.

And this is having a very limited number of seeds. Time is better for seeding.

Quote:
Originally Posted by Thorham View Post
To the human eye your algorithm doesn't produce any patterns, in fact my much simpler algorithm doesn't produce visible patterns, either. This of course doesn't mean that there are no patterns. The problem with your algorithm is that when you generate a table, say, for encryption, that the timers you're using will start to show regular behavior, because you're picking numbers at a regular interval. This means it's likely that your PRGN will be breakable. Only when you pick numbers at irregular intervals might the results be unpredictable.
And my RNG doesn't pick numbers at regular intervals. Interrupts (e.g. for multitasking) can interrupt it and make its result totally unpredictable.
Not to mention that instruction timing is complex enough to be difficult to predict (especially when cache misses occur). Predicting my RNG would need a cycle accurate emulation of the machine it runs on, while exactly knowing the initial machine state !
And this includes not only the CPU, but also the cias and the display HW (i'm reading beam couters, too).

Quote:
Originally Posted by Thorham View Post
Unpredictable PRGNs are used in cryptography, and they're more complex than yours, and even those can be broken, although it's extremely difficult. Actually, there are better PRNGs than yours that aren't secure.
"are used in cryptography" ! But what do you know about them or cryptography itself ???
You haven't seen any encryption code in your life, have you ?
I perhaps still have the sources of PGP somewhere. Maybe a good read...

Quote:
Originally Posted by Thorham View Post
Except that your generator isn't random at all to begin with. No algorithm is. With unfair dice, there is only the chance that a number will show up more often than another, the pattern in which the numbers appear can't be predicted, however.
When you mix timers, old seed, timestamp, beam counters and old value in the system data bus, then you're likely to not show patterns.

Quote:
Originally Posted by Thorham View Post
What I want to know is why you think your PRNG is so good?
Because most of them get one seed, then make fixed, predictable computations based on it, while mine re-reads timers on the fly.

Quote:
Originally Posted by Thorham View Post
I'm not a pen and paper RPG player, and I don't use dice, so I didn't know this. It still doesn't matter, because the pattern your numbers will appear in can't be predicted. While it's easy to see patterns in a small number of throws, let's try ten thousand throws. Even a hundred throws doesn't mean anything.
And a hundred computer generated random numbers - with irregular timing - don't mean anything either.

Quote:
Originally Posted by Thorham View Post
The timigs aren't completely predictable, but there are some regularities, and humans are so slow that the little bit of unpredictability generated doesn't matter much at all.
Humans are slow enough so that their irregularities generate high time differences from a machine's point of view. So in fact it's exactly the opposite of what you're saying.

Quote:
Originally Posted by Thorham View Post
No, you can't see it with the naked eye. My simple, three line algorithm already does that. Your algorithm is too simple to be unpredictable, even with the timers (when generating a table). The moment you call your PRNG regularly (which is the case when making a table), the timers will start showing highly regular behavior, and this means you have patterns. This applies to all algorithms, and your's is not an exception.
This is thinking that the machine has perfectly regular timings, and it is not the case. A difference of 1 unit here and there is enough to kill any predictability.

Quote:
Originally Posted by Thorham View Post
And indeed we don't know this. However, something like radio static is for all intents and purposes truly random, and can't be predicted. There are simply physical events that can't be predicted. If the universe is deterministic than we still can't because we don't know how. Algorithms can always be predicted, although for a certain class of PRNGs this is incredibly difficult.
It may sometimes become so difficult that predictibility is just killed.
And you needn't extremely complex algorithms to achieve this.

Quote:
Originally Posted by Thorham View Post
It is partially, and it's only of use if this data is collected freaquently enough.
It's not a matter of frequency, but a matter of regularity.
If timing variations are higher than the timer's resolution, then it's enough - and it is the case.

Quote:
Originally Posted by Thorham View Post
I can't test it, because I'm not a crypto analyst, but I find it extremely unlikely that your algorithm is cryptographically secure (it's too simple).
Being simple doesn't mean being inefficient. Too bad there is no good rnd analyst here

Quote:
Originally Posted by Thorham View Post
Here's some further reading on the subject: computers are lousy random number generators.
Indeed. It explains things better than i would. Yes, man, the user is outside entropy

Quote:
Originally Posted by daxb View Post
I know a guy with a yellow transparent 20 sided dice. It was incredible but he often threw two or three 1 in a row. Also the judge has a black 20 sided dice often threws the 1. We all feared that littel black dice. Maybe only subjective perception ourselves.
Then play games where you need to make a high value to hit
Oh, well, ok. I knew of a guy who was said to be often throwing 20's at first try, regardless of the used die...
meynaf is offline  
Old 03 July 2010, 21:53   #23
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,810
Quote:
Originally Posted by meynaf View Post
Of course i'm not able to say more than that, but it's enough to make it bad.
It's bad for the dices usual purpose, but for random number generation it's not necessarily bad, because the data can be processed to remove the bias.
Quote:
Originally Posted by meynaf View Post
But this "little data" is more than enough to generate an infinite sequence.
You assume it is, but has to be proved (which I'm not asking you to do). The problem is that when you encrypt data with this, that there may still be patterns that you don't know of. Again, this has to be proven.
Quote:
Originally Posted by meynaf View Post
You're just reversing the question
That's how it looks, I know. The point is that I personally can't think of a reason why it wouldn't be random.
Quote:
Originally Posted by meynaf View Post
You'd probably be surprised to see how poor online gambling games are in that aspect...
Yes, some are, but I'm not talking about the bad ones, and it's not limited to computers. A lottery is a good example of using true RND generators.
Quote:
Originally Posted by meynaf View Post
I have to see an example of this. All crypto code i've seen seemed to work well with relatively poor RNG.
Strong crypto algorithms are concerned with being extremely hard to break, they don't have to produce good all purpose RND data. General purpose RNGs, like your own, are usually much more suited for general cases, but are often not good for encryption.
Quote:
Originally Posted by meynaf View Post
I didn't ask for some case where it is usable. I asked for one where it is needed.
That's simple, it's not necessarily needed It is still usful however.
Quote:
Originally Posted by meynaf View Post
And this is having a very limited number of seeds. Time is better for seeding.
Except that you calculate a 32 bit seed (from what I've seen), and this is also very limited.
Quote:
Originally Posted by meynaf View Post
And my RNG doesn't pick numbers at regular intervals. Interrupts (e.g. for multitasking) can interrupt it and make its result totally unpredictable.
Not to mention that instruction timing is complex enough to be difficult to predict (especially when cache misses occur). Predicting my RNG would need a cycle accurate emulation of the machine it runs on, while exactly knowing the initial machine state !
And this includes not only the CPU, but also the cias and the display HW (i'm reading beam couters, too).
But it needs proof. You're assuming the output is completely unpredictable. You have a point, but it's not enough, I'm afraid.
Quote:
Originally Posted by meynaf View Post
"are used in cryptography" ! But what do you know about them or cryptography itself ???
You haven't seen any encryption code in your life, have you ?
I perhaps still have the sources of PGP somewhere. Maybe a good read...
I actually have. I've been reading up a little on the subject. Check out the SHA-2 algorithm here: SHA-2.
Quote:
Originally Posted by meynaf View Post
When you mix timers, old seed, timestamp, beam counters and old value in the system data bus, then you're likely to not show patterns.
Perhaps, but It still needs checking.
Quote:
Originally Posted by meynaf View Post
Because most of them get one seed, then make fixed, predictable computations based on it, while mine re-reads timers on the fly.
Okay, but is that really very good?
Quote:
Originally Posted by meynaf View Post
And a hundred computer generated random numbers - with irregular timing - don't mean anything either.
What I mean is that you need a very large number of die throws to be able to say things about the output.
Quote:
Originally Posted by meynaf View Post
Humans are slow enough so that their irregularities generate high time differences from a machine's point of view. So in fact it's exactly the opposite of what you're saying.
No The point is that this data doesn't cause much influence. You can generate thousands of numbers in between clicks. If you would only use click times, then the RND numbers will be predictable.
Quote:
Originally Posted by meynaf View Post
This is thinking that the machine has perfectly regular timings, and it is not the case. A difference of 1 unit here and there is enough to kill any predictability.
Do you have proof?
Quote:
Originally Posted by meynaf View Post
It may sometimes become so difficult that predictibility is just killed.
And you needn't extremely complex algorithms to achieve this.
Perhaps not, but in every case it has to be proven if it's to be used in encryption.
Quote:
Originally Posted by meynaf View Post
It's not a matter of frequency, but a matter of regularity.
If timing variations are higher than the timer's resolution, then it's enough - and it is the case.
Perhaps. I think I'll generate a table of seed data with your seed algorithm, and I'll just check that.
Quote:
Originally Posted by meynaf View Post
Being simple doesn't mean being inefficient. Too bad there is no good rnd analyst here
The algorithm without the timer input is probably too simple for encryption. And it's indeed bad that there are no experts on the field here

By the way, sorry for all the proof stuff, but the problem here is that it's very difficult to prove this kind of thing.
Thorham is offline  
Old 03 July 2010, 21:57   #24
TCD
HOL/FTP busy bee
 
TCD's Avatar
 
Join Date: Sep 2006
Location: Germany
Age: 46
Posts: 31,846
No offense meynaf and Thorham, but do you really need to make another excessive multi-quote thread? These are just a pain to read Maybe there's a way to post just what you want to say, instead of quoting each line individually.
TCD is offline  
Old 03 July 2010, 22:45   #25
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,810
Meynaf, I've generated a nice image based on your seeding algorithm. Simply by calling it in a loop and copying the seed to a table and converting the data to an image. The image is in the zone.

When you see this image, you'll notice the high regularities immediately. Note that mouse clicks aren't included because I didn't click anything while generating the table, but as you'll see, it wouldn't have mattered that much anyway.

The problem isn't just limited to regularities. Another one is that your seeding algorithm might be unable to produce all possible seeds. I think you should try and change this seeding algorithm.

Quote:
Originally Posted by TheCyberDruid View Post
No offense meynaf and Thorham, but do you really need to make another excessive multi-quote thread? These are just a pain to read Maybe there's a way to post just what you want to say, instead of quoting each line individually.
Perhaps, but only if this is preferred by most people. Personally I don't like it too much, though, and I'm a big fan of the quote function.
Thorham is offline  
Old 05 July 2010, 11:27   #26
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,350
Quote:
Originally Posted by Thorham View Post
It's bad for the dices usual purpose, but for random number generation it's not necessarily bad, because the data can be processed to remove the bias.
This is pretending to know the bias well enough, but with random stuff you never know

Quote:
Originally Posted by Thorham View Post
You assume it is, but has to be proved (which I'm not asking you to do). The problem is that when you encrypt data with this, that there may still be patterns that you don't know of. Again, this has to be proven.
Encryption doesn't need large amount of random ; 256 bits are more than enough and patterns are much less likely for small amounts.

Quote:
Originally Posted by Thorham View Post
That's how it looks, I know. The point is that I personally can't think of a reason why it wouldn't be random.
Like you said, this has to be proven

Quote:
Originally Posted by Thorham View Post
Yes, some are, but I'm not talking about the bad ones, and it's not limited to computers. A lottery is a good example of using true RND generators.
But here we're talking about computers.

Quote:
Originally Posted by Thorham View Post
Strong crypto algorithms are concerned with being extremely hard to break, they don't have to produce good all purpose RND data. General purpose RNGs, like your own, are usually much more suited for general cases, but are often not good for encryption.
Encryption only needs a key and this is relatively small data (see above).

Quote:
Originally Posted by Thorham View Post
Except that you calculate a 32 bit seed (from what I've seen), and this is also very limited.
Limited, but not even necessary. My random generator could work well even without a seed. In other words, same seed won't generate same sequence.

Quote:
Originally Posted by Thorham View Post
But it needs proof. You're assuming the output is completely unpredictable. You have a point, but it's not enough, I'm afraid.
See below about proof.

Quote:
Originally Posted by Thorham View Post
I actually have. I've been reading up a little on the subject. Check out the SHA-2 algorithm here: SHA-2.
You've been reading on the subject, but this page says nothing about random used, and you apparently haven't seen much code...

Quote:
Originally Posted by Thorham View Post
Perhaps, but It still needs checking.
Just do it ;-)

Quote:
Originally Posted by Thorham View Post
Okay, but is that really very good?
Very good, perhaps not, but better certainly.

Quote:
Originally Posted by Thorham View Post
What I mean is that you need a very large number of die throws to be able to say things about the output.
But usually less than for a computer RNG.

Quote:
Originally Posted by Thorham View Post
No The point is that this data doesn't cause much influence. You can generate thousands of numbers in between clicks. If you would only use click times, then the RND numbers will be predictable.
Click times are used as SEED and nothing more.

Quote:
Originally Posted by Thorham View Post
Do you have proof?
No. But you don't have the opposite proof either.

Quote:
Originally Posted by Thorham View Post
Perhaps not, but in every case it has to be proven if it's to be used in encryption.
See below for proof (again ).

Quote:
Originally Posted by Thorham View Post
Perhaps. I think I'll generate a table of seed data with your seed algorithm, and I'll just check that.
It's not a good idea to use the seed alone. It's not made for that.

Quote:
Originally Posted by Thorham View Post
The algorithm without the timer input is probably too simple for encryption. And it's indeed bad that there are no experts on the field here
See above about encryption (ahem ).

Quote:
Originally Posted by Thorham View Post
By the way, sorry for all the proof stuff, but the problem here is that it's very difficult to prove this kind of thing.
It's not mine to make the proof, but yours in fact. You say it is predictable, so prove it.

Quote:
Originally Posted by TheCyberDruid View Post
No offense meynaf and Thorham, but do you really need to make another excessive multi-quote thread? These are just a pain to read Maybe there's a way to post just what you want to say, instead of quoting each line individually.
Alas this is right, but how to do otherwise ?

Frankly if i could avoid this multi-quoting, i would do it.
But how to answer a message point-per-point without doing so ?

My "see above" and "see below" will try to reduce the number of quotes nevertheless. Now Thorham has to follow...

Quote:
Originally Posted by Thorham View Post
Meynaf, I've generated a nice image based on your seeding algorithm. Simply by calling it in a loop and copying the seed to a table and converting the data to an image. The image is in the zone.

When you see this image, you'll notice the high regularities immediately. Note that mouse clicks aren't included because I didn't click anything while generating the table, but as you'll see, it wouldn't have mattered that much anyway.

The problem isn't just limited to regularities. Another one is that your seeding algorithm might be unable to produce all possible seeds. I think you should try and change this seeding algorithm.
But the purpose of the seeding algorithm isn't to give perfect random. Nor does it need to give all possible seeds. It's still much better than just using the actual timestamp as seed !

Now do your image again with both the seeding algorithm called once at startup and the normal random generator (this time posting your image generation code as well). Then we'll see.
meynaf is offline  
Old 05 July 2010, 11:56   #27
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,810
I'll keep this short, because my knowledge on this subject is too limited (should be highly apparent ).
Quote:
Originally Posted by meynaf View Post
But the purpose of the seeding algorithm isn't to give perfect random. Nor does it need to give all possible seeds. It's still much better than just using the actual timestamp as seed !

Now do your image again with both the seeding algorithm called once at startup and the normal random generator (this time posting your image generation code as well). Then we'll see.
If you've taken a look at the image I've made based on data used by your seeding algorithm, then you'll clearly see the high regularities of those timers, and this is exactly what I'm trying to say. In your PRNG you're using timers to influence the data. Because those timers are in fact not random as shown, your PRNG will not produce true random data as far as I can tell.
Thorham is offline  
Old 06 July 2010, 10:40   #28
Maccara
The Spanish Songstress
 
Join Date: Jul 2009
Location: Finland
Posts: 114
meynaf, you should look up "entropy extraction" (active field of study).

I don't think your timer-shuffling would stand up to scrutiny, if we consider cryptographically secure algorithms - however I'm far from an expert on the subject matter myself so can't claim anything specific.

There are some tests which have to be met at minimum (next-bit test and state compromise extensions at least - can't remember others for now) for an algo to be even considered secure.
Maccara is offline  
Old 08 July 2010, 09:05   #29
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,350
Quote:
Originally Posted by Thorham View Post
I'll keep this short, because my knowledge on this subject is too limited (should be highly apparent ).
Heheh

Quote:
Originally Posted by Thorham View Post
If you've taken a look at the image I've made based on data used by your seeding algorithm, then you'll clearly see the high regularities of those timers, and this is exactly what I'm trying to say. In your PRNG you're using timers to influence the data. Because those timers are in fact not random as shown, your PRNG will not produce true random data as far as I can tell.
But what is "true random" ?

It just needs to be statistically balanced, and unpredictable. So far it is.

Of course i've seen the image, but the seed generator doesn't need to be a rnd generator itself. It's just here to add a few more noise.


Quote:
Originally Posted by Maccara View Post
meynaf, you should look up "entropy extraction" (active field of study).
I've extracted entropy whereever i could find some in the Miggy already.

Quote:
Originally Posted by Maccara View Post
I don't think your timer-shuffling would stand up to scrutiny, if we consider cryptographically secure algorithms - however I'm far from an expert on the subject matter myself so can't claim anything specific.
I'm not only using timers. They're just used to add noise (entropy).

Quote:
Originally Posted by Maccara View Post
There are some tests which have to be met at minimum (next-bit test and state compromise extensions at least - can't remember others for now) for an algo to be even considered secure.
Do you have some links on the subject ?
meynaf is offline  
Old 08 July 2010, 17:07   #30
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,810
Quote:
Originally Posted by meynaf View Post
Heheh
Indeed It's perhaps useful to read up on this subject.
Quote:
Originally Posted by meynaf View Post
But what is "true random" ?
Perhaps this: 'Without any patterns that can be recreated with an algorithm or otherwise, except by chance", or something along those lines.
Quote:
Originally Posted by meynaf View Post
It just needs to be statistically balanced, and unpredictable. So far it is.
Is it truly? There are different kinds of tests you can run.
Quote:
Originally Posted by meynaf View Post
Of course i've seen the image, but the seed generator doesn't need to be a rnd generator itself. It's just here to add a few more noise.
What I meant here is that you're using timers that are regular in the PRNG itself, and this will lead to patterns if you create a table. Of course this setup is perfectly fine if the numbers are generated at irregular intervals.
Quote:
Originally Posted by meynaf View Post
I've extracted entropy whereever i could find some in the Miggy already.
And that's a problem for creating true random numbers. The Amiga's timings are still too regular.

Anyway, as long as you don't say that your RNG produces true random data, it's fine with me. You see, the amount of chaos you can create with the simplest of algorithms is fantastic. Even my simple three line algorithm does that (and is highly regular, except to the naked eye). The problem is making it truly random with out normal hardware RNGs.
Thorham is offline  
Old 08 July 2010, 18:41   #31
Maccara
The Spanish Songstress
 
Join Date: Jul 2009
Location: Finland
Posts: 114
Quote:
Originally Posted by meynaf View Post
Do you have some links on the subject ?
Something I had "on-hand":
next-bit test stuff: http://www.scientiairanica.com/PDF/A...3/eghlidos.pdf
attacks on prng in general, including state compromise extensions: http://www.schneier.com/paper-prngs.pdf

EDIT: One interesting thesis article, which gives good and simple background for estimating entropy (in chap 3) and all that - could be adapted to evaluate your algorithm. Discusses the problem of finding proper source of randomness with enough data on a limited platform.
http://is.muni.cz/th/39510/fi_d/dissertation_thesis.pdf

Lots more (published papers on the subject) can be found if you go google.

I'm not personally qualified (or interested enough) to judge their merits, so I leave that as an exercise for the reader.

Just saying, that if someone wants to seriously make a cryptographically secure prng, there's some work to be done by the author before anyone will even bother to take a look at it seriously, and it is definitely not enough to just claim: "because I say so - there's the code, check yourself"[heavily paraphrased].

EDIT2: Please, do not take this the wrong way. The algorithms proposed are probably quite good enough for all "intended purposes". I just budded in as I saw claims on security without any qualifiers. If I can provide at least useful information what to look for, I'm happy.

Last edited by Maccara; 08 July 2010 at 19:21.
Maccara is offline  
Old 11 July 2010, 19:03   #32
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,350
Quote:
Originally Posted by Thorham View Post
Perhaps this: 'Without any patterns that can be recreated with an algorithm or otherwise, except by chance", or something along those lines.
Then surely some PRNGs can apply ;-)

Quote:
Originally Posted by Thorham View Post
Is it truly? There are different kinds of tests you can run.
I think i will run a few of them !

Quote:
Originally Posted by Thorham View Post
What I meant here is that you're using timers that are regular in the PRNG itself, and this will lead to patterns if you create a table. Of course this setup is perfectly fine if the numbers are generated at irregular intervals.
And that's a problem for creating true random numbers. The Amiga's timings are still too regular.
Yet you might agree that it's perfectly suited for a game - that is, random fighting issues in it, and this was our original subject

Quote:
Originally Posted by Thorham View Post
Anyway, as long as you don't say that your RNG produces true random data, it's fine with me. You see, the amount of chaos you can create with the simplest of algorithms is fantastic. Even my simple three line algorithm does that (and is highly regular, except to the naked eye). The problem is making it truly random with out normal hardware RNGs.
To make something looking random, just compress something with a good data compressor : you'll get seemingly random data (apart headers, of course).

Quote:
Originally Posted by Maccara View Post
attacks on prng in general, including state compromise extensions: http://www.schneier.com/paper-prngs.pdf
I found this very interesting reading, even though a bit too academic for my taste.

Quote:
Originally Posted by Maccara View Post
EDIT: One interesting thesis article, which gives good and simple background for estimating entropy (in chap 3) and all that - could be adapted to evaluate your algorithm. Discusses the problem of finding proper source of randomness with enough data on a limited platform.
http://is.muni.cz/th/39510/fi_d/dissertation_thesis.pdf
But the problem is that Amiga isn't a cell phone. Nice reading nevertheless.

Quote:
Originally Posted by Maccara View Post
Just saying, that if someone wants to seriously make a cryptographically secure prng, there's some work to be done by the author before anyone will even bother to take a look at it seriously, and it is definitely not enough to just claim: "because I say so - there's the code, check yourself"[heavily paraphrased].
I won't do cryptographic applications on my miggy anyway.

Quote:
Originally Posted by Maccara View Post
EDIT2: Please, do not take this the wrong way. The algorithms proposed are probably quite good enough for all "intended purposes". I just budded in as I saw claims on security without any qualifiers. If I can provide at least useful information what to look for, I'm happy.
Nothing's really secure in our big bad world, and with random you never know (by definition), so...
meynaf is offline  
Old 14 July 2010, 21:03   #33
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,810
Quote:
Originally Posted by meynaf View Post
Then surely some PRNGs can apply ;-)
Of course, but many PRNGs are predictable (apparently), only the cryptographic algorithms are extremely difficult to crack.
Quote:
Originally Posted by meynaf View Post
I think i will run a few of them !
Yeah, you should.
Quote:
Originally Posted by meynaf View Post
Yet you might agree that it's perfectly suited for a game - that is, random fighting issues in it, and this was our original subject
More than good enough for a game. However, I'd still test your core algorithm (without the timers and a fixed seed) to see if it cycles too quickly (different seeds can yield different cycles). You might want to use it without timers for generating random dungeons that are the same for each seed value (ensures dungeons are the same across different machines), and for such reasons it's important that it doesn't cycle too quickly (can be slooooooow to test).

However, for game purposes your algorithm seems a little on the slow side:

1) It reads three chipset registers and that is somewhat slow. My solution to this is to use just one in combination with a small (16 kilobyte) true random table. The timer value is simply added to the offset of the table, and the value read from there is the value you add to the state of the RNG. Then you simply don't do this for every call, but for every few calls.

2) It uses a slow multiply.

3) It uses a very slow division for mod.

4) It's a little big to inline in a loop.

If you like optimized code, then you may want to look at these issues. My simple PRNG is only three lines, and can be inlined almost anywhere:
Code:
	rol.l	#7,d0
	add.l	d1,d0
	add.l	#$11111111,d1
You can easily add things such as timers to this and you'd still save a bucket load of cycles.
Quote:
Originally Posted by meynaf View Post
To make something looking random, just compress something with a good data compressor : you'll get seemingly random data (apart headers, of course).
Yes, but it's way to sloooooow

@Maccara: Very good reading, thanks

Last edited by Thorham; 16 July 2010 at 09:24. Reason: Code said rol.l #4,d0. Should be rol.l #7,d0.
Thorham is offline  
Old 15 July 2010, 15:10   #34
modrobert
old bearded fool
 
modrobert's Avatar
 
Join Date: Jan 2010
Location: Bangkok
Age: 56
Posts: 779
Lightbulb

Drifting slightly out of topic perhaps, but thought it might be a fun Amiga project; using a Geiger counter to seed random value via the serial port.



Quote:
This adapter plugs into the digital out of the analog geiger counters and provides a random each time a radioactive particle is detected. The geiger counter is set up to read background radiation. The random numbers generated are truly random since they are based naturally occurring radioactivity.

The random number generate may be set to the following ranges:

Binary (1-2) Heads or Tails
Decimal (1-10)
1 Byte (1 - 255)
2 Byte ( 1 -65535)


The random number generator is compatible with analog meter geiger counters that use either an internal tube or a wand with shielded cable.

Typically, depending upon location, the generator will generate 20-40 random numbers per minute. TTL Serial Output Random numbers are sent out via a TTL serial port that may be interfaced to a micro controller or PC.
LCD Display 16 character by 2 line LCD (liquid crystal display) with back light provides easy to read output.


Source:
http://www.imagesco.com/geiger/analo...r-counter.html

The price is kind of steep, but it might also become useful when the atomic winter is upon us.
modrobert is offline  
Old 17 July 2010, 14:53   #35
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,350
Quote:
Originally Posted by Thorham View Post
Of course, but many PRNGs are predictable (apparently), only the cryptographic algorithms are extremely difficult to crack.
But cryptographic algorithms can be broken too (it's just a matter of computing power), so only the add of more entropy makes sense to me.

Quote:
Originally Posted by Thorham View Post
Yeah, you should.
But unfortunately all i've seen is using stupid float maths and never gives clear result.

Quote:
Originally Posted by Thorham View Post
More than good enough for a game. However, I'd still test your core algorithm (without the timers and a fixed seed) to see if it cycles too quickly (different seeds can yield different cycles). You might want to use it without timers for generating random dungeons that are the same for each seed value (ensures dungeons are the same across different machines), and for such reasons it's important that it doesn't cycle too quickly (can be slooooooow to test).
For random dungeons i'm using a different generator. The one you've seen REQUIRES the timer read.

Quote:
Originally Posted by Thorham View Post
However, for game purposes your algorithm seems a little on the slow side:

1) It reads three chipset registers and that is somewhat slow. My solution to this is to use just one in combination with a small (16 kilobyte) true random table. The timer value is simply added to the offset of the table, and the value read from there is the value you add to the state of the RNG. Then you simply don't do this for every call, but for every few calls.

2) It uses a slow multiply.

3) It uses a very slow division for mod.

4) It's a little big to inline in a loop.

If you like optimized code, then you may want to look at these issues. My simple PRNG is only three lines, and can be inlined almost anywhere:
Code:
 rol.l #7,d0
 add.l d1,d0
 add.l #$11111111,d1
You can easily add things such as timers to this and you'd still save a bucket load of cycles.
But exactly how many random numbers do you need to generate for a game ?
It's not enough for the RNG's speed to count much, unless it's several tens of times slower than mine.

Quote:
Originally Posted by Thorham View Post
Yes, but it's way to sloooooow
Speed isn't an issue here. It's for the example, not for practical use.

Quote:
Originally Posted by modrobert View Post
Drifting slightly out of topic perhaps, but thought it might be a fun Amiga project; using a Geiger counter to seed random value via the serial port.





Source:
http://www.imagesco.com/geiger/analo...r-counter.html

The price is kind of steep, but it might also become useful when the atomic winter is upon us.
If you have a good geiger you needn't wait for the atomic winter to get something out of it
meynaf is offline  
Old 17 July 2010, 15:44   #36
pandy71
Registered User
 
Join Date: Jun 2010
Location: PL?
Posts: 2,858
my advise... just use a Zener diode or special noise diode - they generate flat noise - amplify noise (additionial source of noise), convert to digital by some ADC (additional noise)...
pandy71 is offline  
Old 19 July 2010, 09:42   #37
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,350
Quote:
Originally Posted by pandy71 View Post
my advise... just use a Zener diode or special noise diode - they generate flat noise - amplify noise (additionial source of noise), convert to digital by some ADC (additional noise)...
I think i'll stay with pure software solutions
meynaf is offline  
Old 19 July 2010, 18:22   #38
pandy71
Registered User
 
Join Date: Jun 2010
Location: PL?
Posts: 2,858
small AVR uC (embedded ADC + communication) + very simple analog circuit can give truly random data - this can be difficult to beat in pure software way (if possible at all) - Amiga except paddle interface (it can give some limited randomness due of way how it works) is lack of ADC - this limit randomness...
pandy71 is offline  
Old 20 July 2010, 09:08   #39
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,810
Quote:
Originally Posted by meynaf View Post
But cryptographic algorithms can be broken too (it's just a matter of computing power), so only the add of more entropy makes sense to me.
Sure, but the best cryptographic algorithms are currently not hackable on a practical level (takes too long to be of any use).
Quote:
Originally Posted by meynaf View Post
But unfortunately all i've seen is using stupid float maths and never gives clear result.
That sucks, but can't you at least use the math libs for float?
Quote:
Originally Posted by meynaf View Post
For random dungeons i'm using a different generator. The one you've seen REQUIRES the timer read.
Not from what I've seen, it seems to work fine without the timers. About that dungeon generating PRNG, could you post it, if you want?
Quote:
Originally Posted by meynaf View Post
But exactly how many random numbers do you need to generate for a game ?
Depends on the game
Quote:
Originally Posted by meynaf View Post
It's not enough for the RNG's speed to count much, unless it's several tens of times slower than mine.
I suppose so
Quote:
Originally Posted by meynaf View Post
Speed isn't an issue here. It's for the example, not for practical use.
Okay, but this example still is really slow, although it's a good example of how something may look random while it's not in any way random at all.
Quote:
Originally Posted by meynaf View Post
I think i'll stay with pure software solutions
They're the handiest, until you need true random numbers
Quote:
Originally Posted by pandy71 View Post
small AVR uC (embedded ADC + communication) + very simple analog circuit can give truly random data - this can be difficult to beat in pure software way (if possible at all) - Amiga except paddle interface (it can give some limited randomness due of way how it works) is lack of ADC - this limit randomness...
Or a FM transistor radio connected to the input of a sound card. Costs only a tenner or so. The back draw is that you need some custom software to process the sampled data.
Thorham is offline  
Old 20 July 2010, 13:04   #40
pandy71
Registered User
 
Join Date: Jun 2010
Location: PL?
Posts: 2,858
Quote:
Originally Posted by Thorham View Post
Or a FM transistor radio connected to the input of a sound card. Costs only a tenner or so. The back draw is that you need some custom software to process the sampled data.
Amiga and input of sound card?

FM noise is not always random (some interferences can be quite regular)
Most modern FM receivers do auto-mute
pandy71 is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Random question 251Mario project.EAB 1 16 May 2013 02:19
HELP! A600 number 2 down! :( Snowy support.Other 5 04 December 2011 22:12
Help needed!!Random octal numbers generator(asm) sheryn88 Coders. General 6 01 August 2010 07:19
Random crashes ami_stuff support.WinUAE 8 06 February 2009 16:51
D/Generation IanMac support.Games 2 04 November 2002 16:47

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 12:15.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.19726 seconds with 14 queries