Premium problem57. Place p Elements Randomly

Medium Locked

Randomly place p = 3 ones in a 10×10 array of zeros, at p distinct positions chosen uniformly at random without replacement. Seed the global random state with 0 first for reproducibility: do it inside solve, immediately before the random call, since the seed is global, shared state.

Output

[[0. 0. 1. ... 0. 0. 0.]
 [0. 0. 0. ... 0. 0. 0.]
 [0. 0. 0. ... 0. 0. 0.]
 ...
 [0. 0. 0. ... 0. 0. 0.]
 [0. 0. 0. ... 0. 0. 0.]
 [0. 0. 0. ... 0. 0. 0.]]

Premium problem

This one's part of Premium. Unlock the full NumPy track plus every other premium problem on the site.

Implement solve(...)