The problem is I have two groups say A and B which I have predefined in an array like

```
$random_groups = [B,A,A,B,A,A,B,B,A,A,B,B,B,A,A,B,A,B,B,A,A,A,B,B,A,B,B,B,A,A,A,B,B,A,B,A,A,B,B,B,A,A,A,B,B,A,A,B,A,B,A,B,B,A,B,A,B,A,A,B,B,A,B,A,B,A,B,A,A,B,A,B,B,B,A,A,B,A,B,A...]
```

and when user submits a form he should get B from the above array if he is the first person to register after I apply this logic and if second person registers he should get A, if third he should get A and so on.

I am so confused to have to work around this logic. I tried a few options but didn't got the result properly.