Q:

Write a NumPy program to shuffle numbers between 0 and 10 (inclusive)

0

Write a NumPy program to shuffle numbers between 0 and 10 (inclusive).

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import numpy as np
x = np.arange(10)
np.random.shuffle(x)
print(x)
print("Same result using permutation():")
print(np.random.permutation(10))

Sample Output:

[2 7 1 5 3 9 0 4 6 8]                                                  
Same result using permutation():                                       
[8 9 0 4 7 3 1 6 5 2]

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now