Improved randomrect and first maxrect test