Guest User

Untitled

a guest
Feb 19th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. extension ClosedRange where Bound: BinaryFloatingPoint {
  2. var random: Bound {
  3. let ratio = Bound(arc4random_uniform(UInt32.max)) / Bound(UInt32.max - 1)
  4. let offset = (upperBound - lowerBound) * ratio
  5. return lowerBound + offset
  6. }
  7. }
Add Comment
Please, Sign In to add comment