title: Swift randomFloat issue: '4294967295' is not exactly representable as 'Float'
body: <p>When generating a random CGFloat, I use the following code. <a href="https://stackoverflow.com/questions/34490662/why-use-floatarc4random-0xffffffff-instead-of-drand">Some explanation here</a></p>
  
  <pre><code>extension CGFloat{
       static func randomFloat(from:CGFloat, to:CGFloat) -&gt; CGFloat {
            let randomValue: CGFloat = CGFloat(Float(arc4random()) / 0xFFFFFFFF)
            return randomValue * (to - from ) + from
        } 
  }
  </code></pre>
  
  <p>It used to be OK. Works fine now.</p>
  
  <p>There is a warning, after I upgraded to Swift 5.</p>
  
  <blockquote>
    <p>'4294967295' is not exactly representable as 'Float'; it becomes '4294967296'</p>
  </blockquote>
  
  <p>to the line of code </p>
  
  <pre><code>let randomValue: CGFloat = CGFloat(Float(arc4random()) / 0xFFFFFFFF)
  </code></pre>
  
  <p>How to fix it?</p>