# choice method probability don't have clear explanation

array_RG = gen(pcg(seed=365))

array_RG.choice([1,2,3,9,3,6], p=[0.1,0.1,0.1,0.1,0.1,0.5], size=(5,5))

what is the use of p here, can you explain why values are displayed so and so

Output

```
array([[6, 6, 6, 3, 6],
[1, 6, 2, 6, 3],
[6, 3, 1, 6, 9],
[3, 3, 3, 6, 6],
[6, 1, 6, 6, 2]])
```

2 answers ( 0 marked as helpful)

p stands for probability. If not specified, all the probability are equal. "p=[0.1,0.1,0.1,0.1,0.1,0.5]" is where you *manually* set the probability to how you like. In the example you provided:

array_RG.choice([1,2,3,9,3,6], p=[0.1,0.1,0.1,0.1,0.1,0.5], size=(5,5))

The probability for 1 showing up is approximately 0.1, and the probability for 6 showing up is approximately 0.5.

P specifies the number of times each sequence value will appear in the outcome.