How to test if values are randomly distributed in a matrix?

Moran’s I statistic is commonly used for this in ecology. Not sure if there’s already a Julia implementation, but it shouldn’t be too hard to program yourself.