Привет всем! Правильно ли я перевел perl на php?
PERL
my @indexes;
for my $i ( 0 .. $L - 1 ) {
my %seen;
while (1) {
my $rand = int( rand( $self->d * $SCALE ) );
if ( !$seen{$rand} ) {
$seen{$rand} = 1;
last if keys %seen == $self->k * $SCALE; // ??????
}
}
push( @indexes, [ sort { $a <=> $b } keys %seen ] );
}
$self->_indexes( \@indexes );
PHP
$indexes = null;
for($q=0; $q<$L; $q++){
$seen = null;
while(true){
$rand = rand(0, $d*$SCALE);
if(!$seen[$rand]){
$seen[$rand] = 1;
if(count($seen) == $k * $SCALE)
break;
}
}
$indexes[] = asort($seen);
}