title: function to calculate score
body: <p>Calculate sequence score based on score matrix.</p>
  
  <pre><code>sum(j[k])
  
  
  j &lt;- matrix(1:25, ncol = 5, nrow = 5)
  diag(j) &lt;- 0
  j
  
  n &lt;- 1:5
  k &lt;- sample(n, 5, replace = FALSE)
  k &lt;- replicate(5, sample(n, 5, replace = FALSE))
  </code></pre>
  
  <p>j is score matrix. 
  k is sequence type matrix. </p>
  
  <pre><code>lets say k[1,] = 4 1 5 3 2 
           k[2,] = 2 5 4 2 4
  </code></pre>
  
  <p>solution: Please help answer two issues; </p>
  
  <p>Issue 1: </p>
  
  <p>add one more column to matrix k (lets call it "score"). Based on J matrix the score for this sequence should be 48. </p>
  
  <pre><code>4 1 5 3 2 48 
  </code></pre>
  
  <p>Issue 2: </p>
  
  <p><code>k[2,] = 2 5 4 2 4</code>  The sample function is producing wrong permutations. I don't want any repetition in the sequence. Here 4 is repeated. Secondly 1 is missing. is there any other best way to generate random permutations.</p>