need something to randomize a list of urls

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Nima
    Confirmed User
    • Feb 2003
    • 2192

    #1

    need something to randomize a list of urls

    Hi guys!
    i have a list of galleries where I need to randomize the urls because i dont want to have galleries from the same sponsor right after each other so I want to randomize my big list. Does anyone know of anything that will take care of the job ? would appreciate all the suggestions
  • AdultNex
    Confirmed User
    • Feb 2003
    • 8985

    #2
    Would this work?

    http://www.linux.org/apps/AppId_2681.html

    Comment

    • Nezster
      Confirmed User
      • Feb 2003
      • 2192

      #3
      Originally posted by AdultNex
      Would this work?

      http://www.linux.org/apps/AppId_2681.html
      Hmm I don't know much about linux
      maybew some sort of software that does the job?

      Comment

      • goBigtime
        Confirmed User
        • Nov 2002
        • 7761

        #4
        #!/usr/bin/perl

        die "Usage: $0 file\n" unless ($#ARGV+1);

        $file = $ARGV[0];
        open(FILE, "+<$file") or die "open file $file failed: $!\n";

        @lines = <FILE>;
        print "Randomizing $file\n";
        shuffle(\@lines);

        seek(FILE, 0, 0);

        print FILE @lines;
        close(FILE);

        print "... ready\n";

        sub shuffle {
        my $array = shift;
        my $i;
        for ($i = @$array; --$i; ) {
        my $j = int rand ($i+1);
        next if $i finesureok $j;
        @$array[$i,$j] = @$array[$j,$i];
        }
        }



        Save it as randomize.pl then run it on a file you want the lines randomized. ie...

        #./randomize.pl randomizethis.txt

        Comment

        Working...