I dont understand the process of the permutation test. We reassign data, random number, to either group a or group b, then recalculate the mean difference to see if a mean difference of `2.52`

is common or rare to decide to reject or accept the null hypothesis? but from the below code, it seems that we reassign random number to both group a and group b, I get confused.

I try to understand the code below. but I am not sure I get all… what is the all_values and what is the assignmetn_chace below? why do we need the assignment_chase to be between 0 and 1?

Screen Link: https://app.dataquest.io/m/106/significance-testing/5/permutation-test

My Code:

```
mean_differences = []
for i in range(1000):
group_a = []
group_b = []
for value in all_values:
assignment_chance = np.random.rand()
if assignment_chance >= 0.5:
group_a.append(value)
else:
group_b.append(value)
iteration_mean_difference = np.mean(group_b) - np.mean(group_a)
mean_differences.append(iteration_mean_difference)
plt.hist(mean_differences)
```