[lug] Platform independent randomness

Ken Weinert kenw at ihs.com
Fri Nov 30 06:45:07 MST 2001


* Ed Hill (ed at eh3.com) [011130 06:06]:
> Hi Ken,
> 
> Heres part of a code that I wrote some years ago that does exactly
> what you want.  You'll have to strip out the Tracer() junk (easily
> done) and some other stuff but it should be trivial to convert it
> from C++ into a C code snippet (very portable).
> 
> I'll be happy to help if you need it...
> 
> Ed
> 
> ps - As a bonus the r250 algo has a very long period which made it 
> 
>      good for Monte Carlo methods...  whatever...  ;-)

	Since Ed was kind enough to include code I gave this one a try
first.

	I bastardized it down to C with a couple of changes in the
public functions to ensure that the initialization gets called even if
the user doesn't do it and made the internal functions static - it was
easy code to understand and change - and it works out of the
box. Repeatable sequences on the platforms that matter.

	Thanks a lot - I'm still not sure why the changes I was making
in the previous code I was using didn't work, but that's a lower
priority to track down now. Now on to bigger and better things,
mucking about with PDF file internals.

	Oh, for the curious, this code is used in part of a PDF
process - our documents have 16 char identifiers and I am creating an
8 char owner password out of the doc id. It's nice to be able to
reliably generate the password on multiple platforms :)

-- 
Ken Weinert   kenw at ihs.com 303-858-6956 (V) 303-705-4258 (F)
GnuPG KeyID: 9274F1CE           GnuPG available at http://www.gnupg.org/
GnuPG Key Fingerprint: 1D87 3720 BB77 4489 A928  79D6 F8EC DD76 9274 F1CE
Linux 2.2.14: up 27 days, 14:48
A limerick is a primitive art form; it starts with a pair o'dactyls
   - Solomon Short

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 240 bytes
Desc: not available
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20011130/733279b3/attachment.pgp>


More information about the LUG mailing list