title: How to remove repeated element in a slice?
body: <p>I have made a code to generate random numbers and delete the repeated ones like below:</p>
  
  <pre><code>package main
  
  import (
      "fmt"
      "math/rand"
      "time"
  )
  
  func main() {
      list := [7]int{}
      for i := 0; i &lt; 7; i++ {
      here:
          rand.Seed(time.Now().UnixNano())
          s := rand.Intn(16)
          fmt.Println(s)
          if s != list[0] &amp;&amp; s != list[1] &amp;&amp; s != list[2] &amp;&amp; s != list[3] &amp;&amp; s != list[4] &amp;&amp; s != list[5] &amp;&amp; s != list[6] {
              list[i] = s
          } else {
              goto here
          }
  
      }
      fmt.Println("list:", list)
  }
  </code></pre>
  
  <p>I noticed that there were a lot repeated code like:</p>
  
  <pre><code>s!=list[0]&amp;&amp;list[1]
  </code></pre>
  
  <p>But when I write it to: </p>
  
  <pre><code>s!=list[0:6]
  </code></pre>
  
  <p>It is wrong, how can I do this properly?</p>