View downloadImages.js
// Image count | |
var imgTotal = 0; | |
var imgLoaded = 0; | |
// Get file name from a URL | |
function getFileName(o) { | |
var pos = o.lastIndexOf("/"); | |
return o.substring(pos+1); | |
} |
View color.swift
import Foundation | |
func stringColorCode(_ s: String?) -> String { | |
guard let IDString = s else { | |
return "000000" | |
} | |
let hashInt = IDString.hashValue | |
let c = hashInt & 0xFFFFFF | |
let hexString = String(format:"%06x", c) | |
return hexString.suffix(6).uppercased() |
View LCGrand.cpp
// Example program | |
#include <iostream> | |
#include <string> | |
inline int random1() { | |
static int seed = 703; // seed can be picked randomly | |
return seed = int(seed*48271LL%2147483647); | |
} | |
int main() { |