#!/usr/bin/env swift; /****************************************************************************** * This program demonstrates the math integer functions. * * Copyright © 2020 Richard Lesh. All rights reserved. *****************************************************************************/ import Foundation import Utils // Begin Main let a:Int = 5 let b:Int = 10 let c:Int = -2 // abs, floor, ceil, round, trunc, min, max print(Utils.format("abs({0:d}) = {1:d}", a, abs(a))) print(Utils.format("abs({0:d}) = {1:d}", c, abs(c))) print(Utils.format("min({0:d}, {1:d}) = {2:d}", a, b, min(a, b))) print(Utils.format("max({0:d}, {1:d}) = {2:d}", a, b, max(a, b))) print(Utils.format("min({0:d}, {1:d}) = {2:d}", b, c, min(b, c))) print(Utils.format("max({0:d}, {1:d}) = {2:d}", b, c, max(b, c))) // random numbers print(Utils.format("random({0:d}) = {1:d}", a, Int.random(in: 0..