// Vuckt
// @author: Slipp Douglas Thompson
// @license: Public Domain per The Unlicense.  See accompanying LICENSE file or <http://unlicense.org/>.

import Foundation



#if !swift(>=4.2)
	internal extension Float
	{
		@inlinable static func random(in range:Range<Float>) -> Float {
			let delta = range.upperBound - range.lowerBound
			return Float(arc4random_uniform(UInt32.max)) / Float(UInt32.max - 1) * delta + range.lowerBound
		}
		@inlinable static func random(in range:ClosedRange<Float>) -> Float {
			let delta = range.upperBound - range.lowerBound
			return Float(arc4random_uniform(UInt32.max)) / Float(UInt32.max) * delta + range.lowerBound
		}
	}

	internal extension Int32
	{
		@inlinable static func random(in range:Range<Int32>) -> Int32 {
			let delta = UInt32(range.upperBound - range.lowerBound)
			return Int32(arc4random_uniform(delta)) + range.lowerBound
		}
		@inlinable static func random(in range:ClosedRange<Int32>) -> Int32 {
			let delta = UInt32(range.upperBound - range.lowerBound)
			return Int32(arc4random_uniform(delta + 1)) + range.lowerBound
		}
	}
#endif

// Vuckt
// @author: Slipp Douglas Thompson
// @license: Public Domain per The Unlicense.  See accompanying LICENSE file or <http://unlicense.org/>.

import Foundation



#if !swift(>=4.2)
	internal extension Float
	{
		static func random(in range:Range<Float>) -> Float {
			let delta = range.upperBound - range.lowerBound
			return Float(arc4random_uniform(UInt32.max)) / Float(UInt32.max - 1) * delta + range.lowerBound
		}
		static func random(in range:ClosedRange<Float>) -> Float {
			let delta = range.upperBound - range.lowerBound
			return Float(arc4random_uniform(UInt32.max)) / Float(UInt32.max) * delta + range.lowerBound
		}
	}

	internal extension Int32
	{
		static func random(in range:Range<Int32>) -> Int32 {
			let delta = UInt32(range.upperBound - range.lowerBound)
			return Int32(arc4random_uniform(delta)) + range.lowerBound
		}
		static func random(in range:ClosedRange<Int32>) -> Int32 {
			let delta = UInt32(range.upperBound - range.lowerBound)
			return Int32(arc4random_uniform(delta + 1)) + range.lowerBound
		}
	}
#endif

--- 
+++ 
@@ -9,11 +9,11 @@
 #if !swift(>=4.2)
 	internal extension Float
 	{
-		static func random(in range:Range<Float>) -> Float {
+		@inlinable static func random(in range:Range<Float>) -> Float {
 			let delta = range.upperBound - range.lowerBound
 			return Float(arc4random_uniform(UInt32.max)) / Float(UInt32.max - 1) * delta + range.lowerBound
 		}
-		static func random(in range:ClosedRange<Float>) -> Float {
+		@inlinable static func random(in range:ClosedRange<Float>) -> Float {
 			let delta = range.upperBound - range.lowerBound
 			return Float(arc4random_uniform(UInt32.max)) / Float(UInt32.max) * delta + range.lowerBound
 		}
@@ -21,11 +21,11 @@
 
 	internal extension Int32
 	{
-		static func random(in range:Range<Int32>) -> Int32 {
+		@inlinable static func random(in range:Range<Int32>) -> Int32 {
 			let delta = UInt32(range.upperBound - range.lowerBound)
 			return Int32(arc4random_uniform(delta)) + range.lowerBound
 		}
-		static func random(in range:ClosedRange<Int32>) -> Int32 {
+		@inlinable static func random(in range:ClosedRange<Int32>) -> Int32 {
 			let delta = UInt32(range.upperBound - range.lowerBound)
 			return Int32(arc4random_uniform(delta + 1)) + range.lowerBound
 		}
Fix for Swift 4.0 compat re `range(in:)`

I had previously made the `random(in:)` methods in each vector `@inlinable`, but the polyfill (<4.2) `range(in:)` internal extension wasn't `@inlinable`, resulting in compiler errors in Swift 4.0 regarding public-internal issues when inlineble.

* Made the internal extension `random(in:)` methods `@inlinable` too, which fixes the errors.  
	▸ Apparently it's okay for an inlinable public method to call in internal one as long as it can inline all the way down (or at least to other fully public methods).  
	▸ It's fine to inline these too, since they're ultimately no more complex than a `arc4random_uniform()` call and some basic math— it's likely not very many lines of assembly.