code: function divide(parent, rects) {
    rects.push(parent)
  
    var depth = parent[4]
  
    // var shouldDivide = random.chance(0.4 + 1 / (depth * 0.5 + 1))
    var shouldDivide = random.chance(0.3 + 1 / (depth / 10 + 1))
    if (depth <= 1) {
      shouldDivide = true
    }
  
    if (depth >= MAX_DEPTH || !shouldDivide) {
      return rects
    }
  
    if (parent[2] < 0.01 || parent[3] < 0.01) return rects
  
    var numDivisions = random.int(2, 5)
    var horizontal = random.chance(0.5)
    if (depth === 0) horizontal = false
    if (depth === 1) horizontal = true
  
    for (var i = 0; i < numDivisions; i++) {
      var child = null
      if (horizontal) {
        child = [
          parent[0] + (parent[2] * i * 1) / numDivisions,
          parent[1],
          (parent[2] * 1) / numDivisions,
          parent[3],
          depth + 1
        ]
      } else {
        child = [
          parent[0],
          parent[1] + (parent[3] * i * 1) / numDivisions,
          parent[2],
          (parent[3] * 1) / numDivisions,
          depth + 1
        ]
      }
      var offset = 0.002
      child[0] += offset
      child[1] += offset
      child[2] -= 2 * offset
      child[3] -= 2 * offset
      divide(child, rects)
    }
    return rects
  }
docs: returns array of rects [x, y, w, h, depth]