# Test for random distribution of values in a sequence

I'm looking to measure the degree to which values in a column or list are ordered or pseudo-randomly aligned. In essence I'm trying to distinguish the following scenarios.

Say we have a "sex" column filled with 50 "M" and 50 "F" values.

Examples of "order":

• If the data was sorted we would observe: F, F, F, .. M, M, M or vice versa.
• Similarly, there can be predictable patterns like: F, M, F, M, F, M or F, F, M, M, F, F, M, M

Examples of randomness / randomly assigned positions to the values:

• Any kind of white noise pattern.
• Maybe the test statistic of the runs test Wiki could be a candidate. – Michael M Apr 17 at 9:12
• Thank you for your suggestion. – Andreas Apr 17 at 9:45