Double
extension Double
An extension for Double to allow easy conversion to other formats / values
-
Returns value converted to
CGFloat.Declaration
Swift
public var cgFloatValue: CGFloat { get } -
Returns value converted to
Int.Declaration
Swift
public var intValue: Int { get } -
A random percentage value.
Note
See
Random.swiftdocumentation for more information.Declaration
Swift
static func randomPercentage() -> DoubleReturn Value
Double, representing a random percentage value. -
A random percentage value between
range.minandrange.max.Note
See
Random.swiftdocumentation for more information.Declaration
Swift
static func randomPercentage(within range: PercentageRange) -> DoubleParameters
rangea
PercentageRangeconfiguration that defines the min and max of the rangeReturn Value
Double, representing a random percentage value within the min and maxrangelimits. -
A random percentage value between
range.minandrange.max, limiting the number of decimal places to the value provided.Note
See
Random.swiftdocumentation for more information.Declaration
Swift
static func randomPercentage(within range: PercentageRange, maxDecimalPlaces: Int) -> DoubleParameters
rangea
PercentageRangeconfiguration that defines the min and max of the rangemaxDecimalPlacesan optional configuration that limits the return value to the number of max places specified.
Return Value
Double, representing a random percentage value within the min and maxrangelimits. -
A random percentage value between 0.0 and
range.max, optionally rounded to a number of decimal places.Note
See
Random.swiftdocumentation for more information.Declaration
Swift
static func randomPercentage(withUpperLimitOf range: PercentageRange, maxDecimalPlaces: Int?) -> DoubleParameters
rangea
PercentageRangeconfiguration that defines the min and max of the rangemaxDecimalPlacesan optional configuration that limits the return value to the number of max places specified.
Return Value
Double, representing a random percentage value not exceedingrange.max.
Double Extension Reference