D
David
The documentation for this module says that the random() method
returns a random tuple from the cross product ... I'm stuck, using v.
1.4 calling random always returns the same tuple :
my $i = Set::CrossProduct->new(\@listoflists);
while (1) {
my @list = $i->random();
do something with @list
}
The relevant code from the module is :
sub random
{
my $self = shift;
my @array = map {${ $self->{arrays}[$_] }[
rand($self->{counters}[$_]] }
0 .. $#{ $self->{arrays} };
if( wantarray ) { return @array }
else { return \@array }
}
and initiating rand with something like :
srand (time ^ $$ ^ unpack "%L*", `ps axww | gzip`);
in my code has no effect. Any help gratefully received - a search of
clpm yielded nothing on this module. Thanks in advance.
David
returns a random tuple from the cross product ... I'm stuck, using v.
1.4 calling random always returns the same tuple :
my $i = Set::CrossProduct->new(\@listoflists);
while (1) {
my @list = $i->random();
do something with @list
}
The relevant code from the module is :
sub random
{
my $self = shift;
my @array = map {${ $self->{arrays}[$_] }[
rand($self->{counters}[$_]] }
0 .. $#{ $self->{arrays} };
if( wantarray ) { return @array }
else { return \@array }
}
and initiating rand with something like :
srand (time ^ $$ ^ unpack "%L*", `ps axww | gzip`);
in my code has no effect. Any help gratefully received - a search of
clpm yielded nothing on this module. Thanks in advance.
David