I have an array 4 long, each position can be a value of 1-5, ie [2, 5, 5, 1] is a random such array.
Each of the 4 positions in the array has different weights of 1-6, so for position 1, the probabilities of 1-5 are respectively {1=0.1, 2=0.15, 3=0.05, 4=0.2, 5=0.5}.
For position 2 probs, {0.2, 0.2, 0.05, 0.1, 0.45}
Position 3 probs, {0.05, 0.025, 0.025, 0.3, 0.6}
The final position 4 probs, {0.2, 0.2, 0.3, 0.25, 0.05}.
Four of these arrays will be generated randomly and then placed in order from top to bottom:
[
[2, 5, 5, 1],
[5, 4, 5, 5],
[1, 3, 2, 3],
[5, 4, 4, 5]
]
Now that this has been made, we can rotate it 90 degrees clockwise.
[
[5, 1, 5, 2],
[4, 3, 4, 5],
[4, 2, 5, 5],
[5, 3, 5, 1]
]
If we were to create each of the four arrays again, but this time not be restricted in placing them in order from top to bottom, what is the probability that we can generate the rotated array? So you can generate [4, 2, 5, 5] first (0.2 x 0.2 x 0.6 x 0.05 = 0.0012 = 0.12% chance to generate [4, 2, 5, 5]), and then the other three. But if you generate an array that is not present, then the whole instance is marked as a failure and will need to start again.