Skip to content

Instantly share code, notes, and snippets.

@markuman
Created October 1, 2015 19:35
Show Gist options
  • Save markuman/1c3357ede006c2646b73 to your computer and use it in GitHub Desktop.
Save markuman/1c3357ede006c2646b73 to your computer and use it in GitHub Desktop.
Nine Nine Nine 4/4
127.0.0.1:6379> eval 'local seed = redis.call("INFO") math.randomseed(tonumber(string.match(seed, "uptime_in_seconds:(%d+)")) + tonumber(string.match(seed, "total_commands_processed:(%d+)"))) return string.format("%f", math.random())' 0
"0.219070"
127.0.0.1:6379> eval 'local seed = redis.call("INFO") math.randomseed(tonumber(string.match(seed, "uptime_in_seconds:(%d+)")) + tonumber(string.match(seed, "total_commands_processed:(%d+)"))) return string.format("%f", math.random())' 0
"0.074487"
127.0.0.1:6379> eval 'local seed = redis.call("INFO") math.randomseed(tonumber(string.match(seed, "uptime_in_seconds:(%d+)")) + tonumber(string.match(seed, "total_commands_processed:(%d+)"))) return redis.call("SET", "mykey", string.format("%f", math.random()))' 0
OK
-- local seed = redis.call("INFO")
-- math.randomseed(tonumber(
-- string.match(seed, "uptime_in_seconds:(%d+)")) +
-- tonumber(string.match(seed, "total_commands_processed:(%d+)")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment