<commit_before>#!/usr/bin/perl
#-- Perl script to generate test input for Banker's Algorithm
#-- <NAME>
use strict;
use warnings;

my $tmp;
my @max;
my @alloc;
my @avail;
my @request;
my ($numP, $numR) = @ARGV;
#-- Check for params
if (not defined $numP or not defined $numR) {die "max numP and numR\n"; }


##-- Generate Max Matrix
#generate_matrix(\@max,$numP,$numR);
##-- Generate Alloc Matrix
#generate_alloc_matrix(\@max,\@alloc,$numP,$numR);

#-- Generate Max Matrix
generate_matrix(\@max,$numP,$numR);
#-- Generate Alloc Matrix
generate_alloc_matrix(\@max,\@alloc,$numP,$numR);
#-- Generate available resource vector
generate_matrix(\@avail,1,$numR);
#-- Generate request vector
generate_alloc_matrix(\@avail,\@request,1,$numR);

#-- Print
print_matrix(\@request,1,$numR);
print_matrix(\@avail,1,$numR);
print_matrix(\@max,$numP,$numR);
print_matrix(\@alloc,$numP,$numR);

#-- Randomly fill matrix
sub generate_matrix {
        for (my $p = 0; $p < $_[1]; $p++){
                for (my $r = 0; $r < $_[2]; $r++){
                        $tmp = int(rand(100));
                        $_[0][$p][$r] = $tmp;
                }<commit_msg>Added different sub for avail<commit_after>#!/usr/bin/perl
#-- Perl script to generate test input for Banker's Algorithm
#-- <NAME>
use strict;
use warnings;

my $tmp;
my @max;
my @alloc;
my @avail;
my @request;
my ($numP, $numR) = @ARGV;
#-- Check for params
if (not defined $numP or not defined $numR) {die "max numP and numR\n"; }

#-- Generate Max Matrix
generate_matrix(\@max,$numP,$numR);
#-- Generate Alloc Matrix
generate_alloc_matrix(\@max,\@alloc,$numP,$numR);
#-- Generate available resource vector
#generate_matrix(\@avail,1,$numR);
generate_avail(\@avail,1,$numR);
#-- Generate request vector
generate_alloc_matrix(\@avail,\@request,1,$numR);

#-- Print
print_matrix(\@request,1,$numR);
print_matrix(\@avail,1,$numR);
print_matrix(\@max,$numP,$numR);
print_matrix(\@alloc,$numP,$numR);

sub generate_avail {
        for (my $p = 0; $p < $_[1]; $p++){
                for (my $r = 0; $r < $_[2]; $r++){
                        $_[0][$p][$r] = 100;
                }
        }
}
#-- Randomly fill matrix
sub generate_matrix {
        for (my $p = 0; $p < $_[1]; $p++){
                for (my $r = 0; $r < $_[2]; $r++){
                        $tmp = int(rand(100));
                        $_[0][$p][$r] = $tmp;
                }
{'fraction_non_alphanumeric': 0.19756711409395974, 'fraction_numerical': 0.013842281879194632, 'mean_word_length': 3.0492359932088284, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2174705', 'n_tokens_mistral': 888, 'n_tokens_neox': 850, 'n_words': 211}