Assign pattern in setRandomPattern()