Skip to content
Advertisement

generate matrix of random integers unique per row in python

Is there a way to directly sample a matrix of random integers that are unique on each row? Doing this for each row apart can be slow.

JavaScript

Advertisement

Answer

List comprehension is faster if N, M and K are large:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement