Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,3 @@
def make2d = { nrows, ncols ->
(0..<nrows).collect { [0]*ncols }
}

View file

@ -0,0 +1,19 @@
def r = new Random()
System.in.splitEachLine(/,\s*/) { dim ->
def nrows = dim[0] as int
def ncols = dim[1] as int
def a2d = make2d(nrows, ncols)
def row = r.nextInt(nrows)
def col = r.nextInt(ncols)
def val = r.nextInt(nrows*ncols)
a2d[row][col] = val
println "a2d[${row}][${col}] == ${a2d[row][col]}"
a2d.each { println it }
println()
}