In this new adventure, I need to populate this matrix fast as i can.
So in my mind what i need to do about the variables is:
for ($r = 0 ; $r -lt 5 ; $r++){
new-variable r$r
for ($i = 0 ; $i -lt 5 ; $i++){
$rand = Get-Random -Minimum 0 -Maximum 50
r$r += "$rand,"
}
}
But it doesn't work, it tells me that r0 > is not a known cmdlet.
This should create r0...r4 variables, wich means row0...row4 and each rn would be filled with a Random number followed by a comma.
How to do it?
And...
I really don't know if I'm doing my matrices the right way, but this is what I have now:
$r1 = ""
for ($i = 0 ; $i -lt 4 ; $i++){
$rand = Get-Random -Minimum 0 -Maximum 50
$r1 += "$rand,"
}
$r1 = $r1.Replace(" ",",")
$r1 = $r1.TrimEnd(',')
# Write-Host $r1
$r2 = ""
for ($i = 0 ; $i -lt 4 ; $i++){
$rand = Get-Random -Minimum 0 -Maximum 50
$r2 += "$rand,"
}
$r2 = $r2.Replace(" ",",")
$r2 = $r2.TrimEnd(',')
# Write-Host $r2
$matrix = @(($r1),($r2))
foreach ($g in $matrix) {$g}