[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Random remailing script had. Help.



Thanks to Alan Barrett who sent me a script to get me started with. I have
two questions still.

1) Why not just $second = rand ($#remailers+1), instead of the two line
   $second routine? (And why did I have to add the +1...).

2) How do I output the variables as csh environmental variables that stick
   around after the perl script has executed? I usually use 'setenv' but perl
   didn't like that.

Here is Alan's script, edited a bit by me:

#!/usr/bin/perl

# given a set of remailers, choose two of them at random.
# repeat this operation five times.
# output the resulting list of 10 remailers.


#
# here's the list of remailers to be considered.
# make it as long or as short as you like. (but no shorter than 2 entries!)
#
@remailers = ("One", "Two", "Three", "Four" , "Five", "Six");

#
# seed the random number generator.
# this is not a strong PRNG!
#
srand(time);

foreach $cycle (1..5) {

    # choose random remailers
    $first = rand($#remailers+1);
    $second = rand($#remailers);
    $second++ if $second >= $first;

    # output the choices
    print $remailers[$first],"->",$remailers[$second],"\n";
}

And a few outputs:

Four->One
One->Six
One->Six
Five->Three
Four->Two

One->Four
One->Five
Six->Four
Five->Two
One->Six

Five->Two
Two->Five
Five->Three
Five->Four
Five->Five

I may have screwed it up, as Alan originally had no +1 in the $first line,
and had -1 in the next line, but it never outputed "Six" then.

Background: One-Six will be addresses of Cypherpunk remailers and I am sending
packages of five e-mails (~40K each) to many people a day. I figured why not
appease you guys by helping with the traffic, but do it randomly and chain
off two remailers per e-mail. I want csh variables though, as output. How do
I get these, or how to I fetch the perl variables for a Unix command line
(I am currently using 'setenv name value' then putting $name into a Unix
command)?

-Xenon
P.S. If you wish to e-mail answers (slow!) use [email protected].