title: how to use random string to let or var to url link
body: <p>how to use random string to let or var to url link
  i want to make random string for url
  let url = URL(string:"<a href="https://www.pallive.net/random.json" rel="nofollow">https://www.pallive.net/random.json</a>")</p>
  
  <p>or see the code when i change values in the site linke in the app do not changed,but if i chnage name of url it change
  the code not reload if  i change the value in json and keep same file
  if i want to reload i have to change the name of file how to do some thange
  auotmatic change the url and keep the orginal in the ftp server</p>
  
  <pre><code>import Foundation
  
  
  class Episode
  {
      var title: String?
      var description: String?
      var thumbnailURL: URL?
  
  
      var url: URL?
      var episodes = [Episode]()
  
      init(title: String, description: String, thumbnailURL: URL, createdAt: String, author: String)
      {
          self.title = title
          self.description = description
          self.thumbnailURL = thumbnailURL
  
  
      }
  
      init(espDictionary: [String : AnyObject])
      {
          self.title = espDictionary["title"] as? String
  
         // description = espDictionary["description"] as? String
          thumbnailURL = URL(string: espDictionary["thumbnailURL"] as! String)
  
  
          self.url = URL(string: espDictionary["link"] as! String)
      }
  
      static func downloadAllEpisodes(completion: @escaping ([Episode]) -&gt; ()) {
          var episodes = [Episode]()
  
          let url = URL(string:"https://www.pallive.net/random.json")
  
  
          URLSession.shared.dataTask(with: url!) { (data, response, error) in
  
              if error != nil {
                  print(error)
                  completion(episodes)
              }
              else {
                  if let jsonData = data ,let jsonDictionary = NetworkService.parseJSONFromData(jsonData) {
  
                      let espDictionaries = jsonDictionary["episodes"] as! [[String : AnyObject]]
                      for espDictionary in espDictionaries {
  
                          let newEpisode = Episode(espDictionary: espDictionary)
                          episodes.append(newEpisode)
  
  
                      }
                  }
                 completion(episodes)
  
                  DispatchQueue.main.async(execute: {
                      completion(episodes)
                  })
  
  
              }
  
              }.resume()
      }
  
      func randomString(_ length: Int) -&gt; String {
  
          let letters : NSString = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
          let len = UInt32(letters.length)
  
          var randomString = ""
  
          for _ in 0 ..&lt; length {
              let rand = arc4random_uniform(len)
              var nextChar = letters.character(at: Int(rand))
              randomString += NSString(characters: &amp;nextChar, length: 1) as String
          }
  
          return randomString
  
      }
  
  
  }
  </code></pre>