title: Cannot find type 'T' in scope Swift
body: <p>I state that it is a few years that I have not programmed in Swift, some time ago I had created this extension to randomly access the elements of an array but I get the error &quot;Cannot find type 'T' in scope&quot;</p>
  <pre><code>extension Array {
      func randomElement() -&gt; T {
          let index = Int(arc4random_uniform(UInt32(self.count)))
          return self[index]
      }
  }
  </code></pre>
  <p>How could I solve? I also tried to put Array  in it but I always get the same error</p>