P

@polarit

Lotto-Masiina

Swift
1 year ago
print("LOTTO NUMBERS") var i = 0 repeat { i += 1 var count: Int = 0 let firstNum = Int.random(in: 1...40) var nextNum : Int var rowNum = [firstNum] count += 1

Solar position - Sunrise, sunset, noon, altitude angle

Swift
1 year ago
import Foundation print("Enter location values!") let array = readLine()? .split { $0 == " " } .map(String.init) let now = Date() if let stringArray = array {

Minutes to clock time

Swift
1 year ago
func clocktimeFromMinutes(rawminutes: Double) -> String { // Converts minutes to normal clocktime let rawhours = rawminutes/60 let rawseconds = 60*rawminutes let hours = Int(rawhours) let minutes = Int(rawminutes) % 60 let seconds = Int(rawseconds)

Julian Day (JD) calculated from current Posix time

Swift
1 year ago
import Foundation // Use Date() to get the current date and time let now = Date() // That is UTC. How to get time zone of user? // Get the number of seconds since 1970 the Unix epoch print("Date and time now \(now)") print("Posix seconds \(now.time

Dates and times from current Posix time

Swift
1 year ago
import Foundation // Use Date() to get the current date and time let now = Date() print(now) // That is UTC. How to get time zone +02:00 ? // Get the number of seconds since the Unix epoch print(now.timeIntervalSince1970) // Days of epoch let days

Calculates average, min and max for data in array

Swift
1 year ago
import Foundation // Note: I have written and saved this before today as anonymous author // The origian version is from yesterday at https://www.mycompiler.io/view/J464uosz46v // In this version was added ANSI colour codes - blue text on white back