title: Sized generators in scalacheck
body: <p><a href="http://code.google.com/p/scalacheck/wiki/UserGuide" rel="noreferrer">UserGuide</a> of scalacheck project mentioned sized generators. The explanation code </p>
  
  <pre><code>def matrix[T](g:Gen[T]):Gen[Seq[Seq[T]]] = Gen.sized {size =&gt;
   val side = scala.Math.sqrt(size).asInstanceOf[Int] //little change to prevent compile-time exception
   Gen.vectorOf(side, Gen.vectorOf(side, g))
  }
  </code></pre>
  
  <p>explained nothing for me. After some exploration I understood that length of generated sequence does not depend on actual size of generator (there is resize method in Gen object that "Creates a resized version of a generator" according to javadoc (maybe that means something different?)).</p>
  
  <pre><code>val g =  Gen.choose(1,5)
  val g2 = Gen.resize(15, g)
  println(matrix(g).sample) //  (1)
  println(matrix(g2).sample) // (2)
  //1,2 produce Seq with same length 
  </code></pre>
  
  <p>Could you explain me what had I missed and give me some examples how you use them in testing code?</p>