function [A u] = place_N_queens_cols(N) % this function places N queens on the NxN board, % one in each column A = zeros(N); for i = 1: N p=randperm(N); p=p(1); A(p, i) = 1; end end