title: create a random non-singular matrix reliably
body: <p>How can I create a matrix of pseudo-random values that is guaranteed to be non-singular? I tried the code below, but it failed. I suppose I could just loop until I got one by chance but I would prefer a more elegant "R-like" solution if anyone has an idea.</p>
  
  <pre><code>library(matrixcalc)
  exampledf&lt;- matrix(ceiling(runif(16,0,50)), ncol=4)
  is.singular.matrix(exampledf) #this may or may not return false
  </code></pre>
  
  <p>using a while loop:</p>
  
  <pre><code>exampledf&lt;-NULL
  library(matrixcalc)
  while(is.singular.matrix(exampledf)!=TRUE){
    exampledf&lt;- matrix(ceiling(runif(16,0,50)), ncol=4)
  }
  </code></pre>