Improved random_sparsevec subroutine [skip ci]

This commit is contained in:
Andrew Kane committed 2026-12-02 22:04:36 -08:00
1 parent aced364bb2
commit fcbcbaf45c
1 file changed
+1 -1
+1 -1
View File
@@ -19,7 +19,7 @@ sub random_sparsevec
my ($nnz) = @_;
my @elements;
my %indices;
while (keys %indices < $nnz)
while (@elements < $nnz)
{
my $index = int(rand(100000)) + 1;
if (!exists($indices{$index}))