title: How to create random dynamic 2D arrays in SystemVerilog?
body: <p>I know how to create a random dynamic array in SystemVerilog:</p>
  
  <pre><code>class packet;
      rand int unsigned len;
      rand byte data[];
  
      constraint size_con {
          len &lt; 2000;
          data.size = len;
      }
  endclass: packet
  </code></pre>
  
  <p>but I can't figure out how to use random 2d dynamic array?</p>
  
  <pre><code>class video_frame;
      rand int unsigned width;
      rand int unsigned height;
      rand int unsigned data[][];
  
      constraint size_con {
          width &gt;= 8;
          width &lt;= 4096;
          height &gt;= 8;
          height &gt;= 2048;
          // How to constraint data.size to be [height, width]
      }
  endclass: video_frame;
  </code></pre>