[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: "freebie" code / random number generator.



> Neat!  What are you using random numbers for?  Filling in data on
> those reports that no one reads anyway?  ;)

actually, it's a bit more complex than that =)
i just started here some four weeks ago,
and already they have me leading (and more or less
executing, solo) a project to take all confidential
fields in our Production environment and scrambling
the heck out of it so we can use the same complement
of data in our Development/Test environs, without the
worry of personal employee data "leaking" out of the company.

i needed the RNG to create a brand new set of EMPLID's
for all the existing ones, so that even if we forgot to code
up modifications of some of the personal fields, someone
STILL couldn't get to an employee's now-semi-garbled data
via their Employee ID.

> I'd be careful with any RNG that you're using for critical applications
> RNG's may look like they generate "good" pseudo-random numbers, but
> many of them don't.

the distribution/deviation of the numbers isn't so important
as having a large set of unique psuedo-random numbers.

> run some basic statistical analysis on it.  Numbers that look very
> random may start to repeat after a certain number of iterations, may
> show odd patterns when added together in sequence, and so on.

patterns when adding, i can see.
but actually the code i distributed creates a table
and makes sure it doesn't insert a number it already
generated.  in theory, given enough time and database storage
space, you could generate all the numbers between 0 and specified
maximum range (#RNDRANGE), but in a new, random order.

> It's a pity that SQR doesn't include a basic rand() function.  A
> system-level function would be many times faster than one written in
> SQR.  5000 numbers in 3 minutes isn't a lot, but it's not *your* fault
> SQR is slow. =)

that's 5000 *unique* 5-digit randoms in 3 minutes.
that's something.
what's more is that it generates the first 1000 in 20 seconds ;-)
(and of course it slows down exponentially as it starts
doing extra iterations to prevent duplicates.)

> Thanks for sharing!

hey, i've gotten lots of tips here.
just investing in its continuing success.

(kris)janis p. gale
hrsd - federal reserve bank of new york
x8163