Description:
Take a value of integer and split to pieces
def split(width:Int, splitTo:Int): Seq[(Int, Int)] ={
val unit = width/splitTo
(0 until splitTo).map{it=>
(it*unit, if((it+1)==splitTo) width else ((it+1)*unit-1))
}
}
If split into {splitTo} pieces, there will an {extra} value exist.
The value of {extra} is smaller than {splitTo}
// width = unit*splitTo + extra
val unit = width / splitTo
The {extra} part will be included in the last split