Determining Ethernet HW Address

Grant Edwards nobody at nowhere.nohow
Thu Mar 30 23:17:13 EST 2000


In article <Pine.OSF.4.20.0003311330090.705-100000 at azure.dstc.edu.au>, Anthony J Wilkinson wrote:

>>>>I'm still curious of what use the Ethernet address is to an application?
>>>
>>>Perhaps globally unique random number generation?
>>
>> My Ethernet addresses aren't random -- they're all quite predictable.
>> In fact, they read the same each time I check them.  Not too useful for
>> random number generation.
>
>But useful to give a different seed to a random function for each
>different machine.

But it's different in an utterly predictable and time-invariant way.

>Combine this with date/time and you have a very good candidate for a
>globally unique number which will certainly improve pseudo-random functions.

No, it won't improve a pseudo-random function.  The pseudo-random function
will still have the same periodicity and correlation features (or whatever
the random-number experts call it).  All you're doing is adding a constant
value to the seed.  By adding the Ethernet address to the seed, you're just
starting at a different place in the sequence generated by the pseudo-random
number generator.  And that "difference" is a constant!

If you've got a pseudo-random number generator that generates a lousy
sequence, then starting at a different place in the sequence isn't helping
anything:

Let's say your p-r sequence is:

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 ....

As you can see, it has a cycle length of 10, so we'll pick a seed value of
(system_time_in_microseconds() % 10), and that value will determine where in
the cycle we start.  [We're assuming we can measure system time with a
resolution of microseconds.]

Now let's modify the seed value with a constant (e.g. a number derived from
the Ethernet address, we'll assume that for a particular computer that comes
out to 4)

So now seed = (system_time_in_microseconds() + 4) % 10

That doesn't improve anything.  The output is no more random than before. It
is no easier or harder to predict the output of the algorithm.  You have
accomplished nothing by adding a constant value to the seed.  In practice,
adding a _random_ value to the seed won't even improve anything unless the
seed was a constant to start with.  For all practical purposes, the seed was
already random (generating a fairly random seed isn't all that hard).

While my example seems overly-simplivied, the same applies if you're using
a generator with a cycle length of 2^32.

>Random functions aren't really random - if you give them the same input
>(seed) they will return the same output.

And adding a constant (such as the Ethernet address) to that input doesn't
improve the "randomness of the output" it just changes it in an entirely
predictable and repeatable way.  Adding a constant value to the seed
accomplished nothing.

You can't generate more or better randomness by shoving more constants (such
as an Ethernet address) into a function.

-- 
Grant Edwards                   grante             Yow!  I love ROCK 'N
                                  at               ROLL! I memorized the
                               visi.com            all WORDS to "WIPE-OUT"
                                                   in1965!!



More information about the Python-list mailing list