- generate random matrix
- multiply it by its own transposition
- you have obtained a positive semi-definite matrix.
Example code (Python):
import numpy as np
matrixSize = 10
A = np.random.rand(matrixSize, matrixSize)
B = np.dot(A, A.transpose())
print 'random positive semi-define matrix for today is', B