Skip to content

Instantly share code, notes, and snippets.

@cegiela
cegiela / ColorHash
Created March 17, 2017 16:34
Just the code for repeatably hashing a string into a color
//Based on https://github.com/ngs/color-hash.swift
import UIKit
import XCPlayground
//magic numbers taken from original
let seed = CGFloat(131.0)
let seed2 = CGFloat(137.0)
let maxSafeInteger = 9007199254740991.0 / seed2

PaintCode Expressions

Operators

!b boolean logical negation of b
x * y numbers product of numbers x and y