title: Static methods may only be declared on a type
body: <p>I am getting an error that says: </p>
  
  <blockquote>
    <p>Static methods may only be declared on a type</p>
  </blockquote>
  
  <p>How can I solve this ?</p>
  
  <pre><code>public static func random(min min: CGFloat, max: CGFloat) -&gt; CGFloat {
  
      return CGFloat.random() * (max - min) + min
  }
  </code></pre>
  
  <p>This is how I am calling the above method from the SWIFT class.</p>
  
  <pre><code>var ran = CGFloat.random(min:-255, max:588)
  </code></pre>