For Programmers: Free Programming Magazines  


Home > Archive > PERL Miscellaneous > May 2006 > Re: tutorial on dynamic SID generation









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: tutorial on dynamic SID generation
DJ Stunks

2006-05-31, 4:01 am

Nospam wrote:
> Is there a tutorial on dynamic SID generation?


I don't know of one, but how about something like this:

#!/usr/bin/perl

use strict;
use warnings;

my $number_of_sids = 10;
my $max_sid_size = 10;

my @sids = sort {$a <=> $b}
map {int rand( '1' . 0 x rand $max_sid_size )}
(1..rand $number_of_sids);

for my $i (0..$#sids) {
printf "SID %d: %d\n", $i+1, $sids[$i];
}

__END__

HTH,
-jp

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com