random pattern routine