Thanks for all of the input, this has been a very interesting discussion.  

Basically, I was looking for a pure PIPE approach to this (mainly to explore 
areas I have yet to use).

Thanks,
 
Frank M. Ramaekers Jr.
 
 

-----Original Message-----
From: CMSTSO Pipelines Discussion List [mailto:cms-pipeli...@vm.marist.edu] On 
Behalf Of Glenn Knickerbocker
Sent: Tuesday, July 20, 2010 4:45 PM
To: CMS-PIPELINES@VM.MARIST.EDU
Subject: Re: [CMS-PIPELINES] PIPE to generate random passwords

Mark Wheeler wrote:
> 'PIPE ... | TAKE' random(6,8) '| ...'

That will skew the distribution towards the shorter passwords.  To
distribute them more evenly, allow a blank in the last positions with
the same likelihood as any character:

  (end \) random 36
    | take 6
    | f: fanin

    | not chop 3
    | join *
    | change x36 ,,
    | x: xlate
    | ...
    \  random 37
    | take 2
    | f:
    \ strliteral ,0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ ,
    | x:

To generate a stream of them, you can use GATHER instead of TAKE|FANIN,
and then you can even out the distribution better by discarding some:

  (end \) literal 11111122
    | dup *
    | fblock 1
    | g: gather streamid
    | not chop 3
    | join 7
    | change x3636 ,,
    | pick 7 ¬== x36
    | chop x36
    | x: xlate
    | ...
    \ random 36
    | g:
    \ random 37
    | g:
    \ strliteral ,0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ ,
    | x:

Then use GATHER, SPECS, SYNCH, or whatever to match them up with your
input file of userids.

Something does seem screwy with the output of RANDOM in my trials of
this, though.  I tried it with 3 and 4 in place of 36 and 37, and in
each trial there were several sequences I never got out of RANDOM 4.
In one it was 02, 11, 20, and 33; in the next it was 00, 13, and 22
(and I'd guess from the pattern 31, but I discarded those).  If I use
any other byte of the output, though (multiplying the moduli by a power
of 256), the distributions look fine.  So in the above you can change:

    | g: gather streamid
    | not chop 3
...
    \ random 36
    | g:
    \ random 37
    | g:

to:

    | g: gather streamid
    | specs 3 1
...
    \ random 9216
    | g:
    \ random 9472
    | g:

¬R

_____________________________________________________
This message contains information which is privileged and confidential and is 
solely for the use of the
intended recipient. If you are not the intended recipient, be aware that any 
review, disclosure,
copying, distribution, or use of the contents of this message is strictly 
prohibited. If you have
received this in error, please destroy it immediately and notify us at 
privacy...@ailife.com.

Reply via email to