Rash64: The Fast Insecure Random Number Generator Function

Douglas Crockford
2017-03-03

Rash64 is a fast but insecure random number generator function. There are two candidate functions shown here. We need to determine which one is better, and if the better one is any good.

It is an adaptation of Fash64.

This is an implementation in a mythical language.

def prime := 9999999999999999961

# The state of the random number generator function is kept in 2 variables.

var result: uint64
var sum: uint64

def rash64_seed(seed: uint64) {
    result : seed
    sum : 1
}

def rash64() {
var high
var low
high ; low : result * prime
sum +: high
result : low xor sum
return result
} def rash64c() {
var high
var low
high ; low : result * prime
counter +: 1
result : (low xor high) + counter
return result
}