Is there a facility in LISP for generating large random numbers - 128 bits
(globally unique ids) that can be used for replication, etc.? Windows has a
facility but it is platform specific.
Thanks
you can always write one.
"Bruce Lester" <············@email.com> wrote in message
····························@newsreader.visi.com...
> Is there a facility in LISP for generating large random numbers - 128 bits
> (globally unique ids) that can be used for replication, etc.? Windows has
a
> facility but it is platform specific.
>
> Thanks
>
>
"Bruce Lester" <············@email.com> writes:
> Is there a facility in LISP for generating large random numbers - 128 bits
> (globally unique ids) that can be used for replication, etc.? Windows has a
> facility but it is platform specific.
Aren't GUID supposed to take a few bits from the host's MAC address
and other hardware sources? It doesn't seem like there could actually
be a platform independent solution for doing this. Unsurprisingly, the
code for generating these numbers in the OSF's reference
implementation of the DCE is littered with calls to machine-specific
interfaces.
"Bruce Lester" <············@email.com> writes:
> Is there a facility in LISP for generating large random numbers - 128 bits
> (globally unique ids) that can be used for replication, etc.? Windows has a
> facility but it is platform specific.
Do you need real random numbers, i.e. something created by a physical
process, or pseudo random numbers, i.e. numbers with a number of
similar properties that real random numbers have, but which are
created by a deterministic process, misleadingly called a (pseudo)
random number generator?
For real random numbers, you probably will have to depend on platform
specific facilities, since there is no platform spanning standard on
either the processes involved, nor their interfaces to user-programs.
My favourite source is a scintillation-counter feeding into
/dev/random on Linux systems (actually, when I used this kind of
setup, there was no /dev/random on Linux, so I created my own). For
lesser needs just using IRQ patterns, etc. feed into /dev/random (or
equivalent facilities) might suffice.
For pseudo random numbers, you can use random as specified in the ANSI
CL standard, after having verified that your vendor's implementation
of random uses a suitable algorithm.
But since you want GUIDs, you probably want the former, and not the
latter.
Regs, Pierre.
--
Pierre R. Mai <····@acm.org> http://www.pmsf.de/pmai/
The most likely way for the world to be destroyed, most experts agree,
is by accident. That's where we come in; we're computer professionals.
We cause accidents. -- Nathaniel Borenstein
In openbsd there is a random number generator device you can use, I think it
is implemented in various BSD's it's a software device
Bruce Lester <············@email.com> a �crit dans le message :
·······················@newsreader.visi.com...
>
"Bruce Lester" <············@email.com> writes:
> Is there a facility in LISP for generating large random numbers -
> 128 bits (globally unique ids) that can be used for replication,
> etc.? Windows has a facility but it is platform specific.
This probably _ought_ to be fairly platform-dependent; I'd be inclined
to build a "GUID" by combining such things as:
- Host identification (e.g. - (machine-instance)), which if
compressed a little probably consumes about 64 bits, or go after an
Ethernet MAC address, which is truly supposed to be unique.
- Date and time (e.g. - (get-universal-time)), which consumes around
32 bits
- And then a random component. If 64+32 are being provided by the
other components, you really only need 32 additional bits.
That makes it systematically likely that there won't be collisions,
not even at _low_ probability.
As for tossing in some platform-dependent "true randomness," a number
of the "free" Unixes offer this sort of thing. For instance, Linux
has a "/dev/random" device that uses cryptographic hashing to mix
together into random jumbledness inputs from things like timings
between key presses, network events, disk I/O, and such. The BSDs
probably have similar, perhaps even with the same device name.
If you've got other sources of "salt," as with host/time stamps, it's
not overly important that the random values be _truly_ random; (random
(* 65536 65536)) is probably entirely good enough to round things out.
--
(reverse (concatenate 'string ··········@" "enworbbc"))
http://www.ntlug.org/~cbbrowne/resume.html
"Open Software and freeing source code isn't socialism. It isn't
socialist. It's neither socialist nor capitalist; it just is."
-- Arthur <······@usa.net>
········@hex.net writes:
> "Bruce Lester" <············@email.com> writes:
> > Is there a facility in LISP for generating large random numbers -
> > 128 bits (globally unique ids) that can be used for replication,
> > etc.? Windows has a facility but it is platform specific.
>
> This probably _ought_ to be fairly platform-dependent; I'd be inclined
> to build a "GUID" by combining such things as:
>
> - Host identification (e.g. - (machine-instance)), which if
> compressed a little probably consumes about 64 bits, or go after an
> Ethernet MAC address, which is truly supposed to be unique.
>
> - Date and time (e.g. - (get-universal-time)), which consumes around
> 32 bits
>
> - And then a random component. If 64+32 are being provided by the
> other components, you really only need 32 additional bits.
Good suggestion. I might add it to CL.ENVRONMENT.
> That makes it systematically likely that there won't be collisions,
> not even at _low_ probability.
What is lower than "low probability" :)
Cheers
--
Marco Antoniotti ========================================================
NYU Courant Bioinformatics Group tel. +1 - 212 - 998 3488
719 Broadway 12th Floor fax +1 - 212 - 995 4122
New York, NY 10003, USA http://bioinformatics.cat.nyu.edu
"Hello New York! We'll do what we can!"
Bill Murray in `Ghostbusters'.
········@hex.net writes:
> between key presses, network events, disk I/O, and such. The BSDs
> probably have similar, perhaps even with the same device name.
Yeah, that's right:
random(4), FreeBSD:
"ACKNOWLEDGEMENTS
The original core code was written by Theodore Ts'o, and was intended for
the Linux platform. This was ported to FreeBSD by Mark Murray, who also
wrote the rndcontrol(8) utility. [...]"
OpenBSD has it, too.
--
johs