How can I generate in Python a matrix with n random elements between 1 and 30 and the rest of the elements equal to zeros?
Create the matrix with zeros, and then add the random numbers, or create an empty matrix, add the random numbers, and fill the empty values with 0.
I have to generate a matrix with of shape 10^4 x 10^4 with 100 integer items randomly chosen 1 and 30 and the rest of the elements equals to 0. Can anybody help me? :pray