contract Random {
    // Generates a random number from 0 to max based on the last block hash.
    function getRand(uint blockNumber, uint max) constant internal returns(uint) {
        return(uint(sha3(block.blockhash(blockNumber))) % max);
    }
}
// Random is a block hash based random number generator.
function getRand(uint blockNumber, uint max) constant internal returns(uint) {
    return(uint(sha3(block.blockhash(blockNumber))) % max);
}

// Generates a random number from 0 to max based on the last block hash.