numpy randomly swap lines

Solutions on MaxInterview for numpy randomly swap lines by the best coders in the world

showing results for - "numpy randomly swap lines"
Helena
04 Jun 2018
1>>> X = np.random.random((6, 2))
2>>> X
3array([[ 0.9818058 ,  0.67513579],
4       [ 0.82312674,  0.82768118],
5       [ 0.29468324,  0.59305925],
6       [ 0.25731731,  0.16676408],
7       [ 0.27402974,  0.55215778],
8       [ 0.44323485,  0.78779887]])
9
10>>> np.random.shuffle(X)
11>>> X
12array([[ 0.9818058 ,  0.67513579],
13       [ 0.44323485,  0.78779887],
14       [ 0.82312674,  0.82768118],
15       [ 0.29468324,  0.59305925],
16       [ 0.25731731,  0.16676408],
17       [ 0.27402974,  0.55215778]])
18