Work on random rect function