Fun with GUIDs *** Geek Topic Advisory ***

by Elsewhere 22 Replies latest jw friends

  • Pole
    Pole

    I've heard that GUIDs are pseudo-random. So are all "random" numbers generated by compilers. Anyone know why? I've heard it is possible to reverse engineer sequences of "random" numbers generated by compilers. In theory of course.
    Pole

  • Valis
    Valis

    Elsewhere trying to calculate GUID's

  • Elsewhere
    Elsewhere

    The GUID value is based on numbers it gets from your computer's clock. This guarantees that you will never generate the same GUID twice so long as you never turn your computer's clock back.

    Pseudo Random Numbers (PRN) are not generated by the compiler, the program itself uses an algorithm to create pseudo random numbers.

    A very simple PRN algorithm would be:

    r = sin(n) * x

    Basically you just get the sin of a seed number, such as your clock's time, and then multiply it by how ever many decimal places you want. You could also just grab a certain range of digits since most sin values will be irrational numbers.

    Since the PRN is calculated, yes, one could "reverse engineer" a random sequence of numbers and even predict what future ones will be -- you just need to run the calculation before the other person does and know exactly what their clock's time is.

    Pay no attention to Valis, he's having a bad dream right now..... just go back to sleep now... just go back to sleep....

  • seattleniceguy
    seattleniceguy
    I've heard that GUIDs are pseudo-random. So are all "random" numbers generated by compilers. Anyone know why?

    As Elsewhere points out, the compiler does not generate random numbers, as it would be a very bad design to literalize your "random" number in the compiled code! :-)

    As to the question of why random numbers are merely pseudo-random, it's because a computer is a deterministic machine and has no way of creating anything by chance. The best we can hope for are numbers that are a) unpredictable and b) fairly evenly distributed through a the problem space (that is, if we are generating numbers between 0 and 1, hopefully there is no "clumping" but the numbers are scattered evenly throughout the space).

    I was unaware that the sin function is used, but that makes sense since it is a cyclical function that will always produce a number between given bounds (-1 and 1 in this case) no matter what the input, and the results are hard to predict, yet evenly distributed. Cool!

    SNG

  • Pole
    Pole

    I didn't mean the compiler actually (but rather core libraries of programming languages), but thanks for pointing it out anyway.

    SNG,

    As for the "even" distribution I guess we need to be aware that there are many different "even" distributions of the probability function. So define evenness ;-)

    I've just found an interesting page on the topic of RNGs:

    http://answers.google.com/answers/threadview?id=23788

    pole

  • seattleniceguy
    seattleniceguy

    Pole

    As for the "even" distribution I guess we need to be aware that there are many different "even" distributions of the probability function. So define evenness ;-)

    I just meant that your random number generator would obviously suffer if it tended to clump in certain areas, since a person running a brute force attack, for example, could focus in the areas where the numbers were more likely to be.

    What is a Gaussian distribution, by the way?

    SNG

  • Simon
    Simon
    GUID: Guaranteed Unique ID

    Actually, that's not quite right. It's "Globally Unique ID". It is not guaranteed to be unique, it is just an extremely small probability.

    Each pseudo random key cannot be guaranteed to be unique but because there are so many possible values the chance of two being the same is practically zero.

    ... which almost guarantees that a duplicate will occur with something important and crash a spaceship or something !

  • Pole
    Pole

    SNG,
    I am sorry - I missed your reply.

    I just meant that your random number generator would obviously suffer if it tended to clump in certain areas, since a person running a brute force attack, for example, could focus in the areas where the numbers were more likely to be.



    I know, I just wanted to sound smart after you've pointed out my careless statement about compilers ;-) LOL.
    Seriously, though:

    What is a Gaussian distribution, by the way?
  • Pole
    Pole

    It's another name for the "normal distribution". What it means is that when you pick items randomly from a population that follows this distribution, you can expect that there will be very few extreme values and that most values will cluster around the mean. So geometrically, this distribution can be plotted as a gaussian curve (a bell-shaped line). Mathematically, the normal distribution has a few interesting features which allow us to quantify our probability judments. For instance, you can know how certain it is to obtain an item with a certain value, etc. One example of a normal distribution is people's IQ scores. There are very few people wwith high IQs and very few people with very low IQs. Some psychologists, however, claim that IQ distibution is positively or negatively skewed, depending on the sex.
    What is interesting is that this distribution is not "the only game in town". many natural phenomena follow other distibutions. For instance, frequencies of phone calls for some strange reason are best modelled by the Poisson distribution.
    This is as much as I can produce "on the spot" - you can find the mathematical details in any textbook or on the net. (start here):
    http://en.wikipedia.org/wiki/Gaussian_distribution
    It's off topic, but I think you may want to have a look at some of those basic statistical concepts since they help refute the creationist fallatious argument along the lines of "I don't believe it has all occurred randomly". In fact many phenomena are not so perfectly random. They follow a certain distribution.
    Pole

  • DannyBloem
    DannyBloem
    Gaussian

    I think the gaussian distribution is the same as the normal distribution mentioned in the thread.

    This gaussian distribution is observed in nature a lot. Especially in quantum physics.
    Even if it is a distribution it can be used to create perfect random numbers.

Share this

Google+
Pinterest
Reddit