Generates a spiral matrix of size N^2.