Skip to content

Instantly share code, notes, and snippets.

View Paint Code

PaintCode Expressions


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

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