I've the following code:
    
    
    import random,strutils,rdstdin
    
    type
      Matrix[W,H:static[int]]=
        array[1..W,array[1..H,int]]
    
    proc RandMatrix(w,h,r1,r2:int):auto=
      var
        mat:Matrix[w,h]
      for i in 1..w:
        for j in 1..h:
          mat[i][j]=rand(r1..r2)
      return mat
    
    var
      w,h,r1,r2:int
    
    w = parseInt(readLineFromStdin "W: ")
    h = parseInt(readLineFromStdin "H: ")
    r1 = parseInt(readLineFromStdin "R1: ")
    r2 = parseInt(readLineFromStdin "R2: ")
    
    var
      mat=RandMatrix(w,h,r1,r2)
    
    for i in 1..w:
      for j in 1..h:
        stdout.write mat[i][j]
        echo  ""
    

At the RandMatrix function, I declared: 
    
    
    var mat:Matrix[w,h]
    

But w,h are int, and the Matrix type just accept static[int], how can I solve 
that? I just tried to exchance static[int] for int, but without any success.

Reply via email to