"Bruno Luong" <firstname.lastname@example.org> wrote in message news:email@example.com...
*snip Bruno's approach*
Not bad. Another approach:
n = 5; A = sign(randn(n)); % Technically you'd need to replace any 0's in A with -1 or 1 % The odds of that happening are so small I'm going to neglect this step for the example A = triu(A, 1)+triu(A, 1).'