So I spent all of 30 seconds on a python version of the same code. Chances are pretty good that the code will work. I do not know for certain because 2.6.0 is not ready yet and I'm not in a position to install unstable yet. Of course I could run it in userspace but that's another topic.
r = redis.Redis()
RandomPushScript = """
local i = tonumber(ARGV)
while (i > 0) do
res = redis.call('lpush',KEYS,math.random())
i = i-1
One of the crappy things about python is the indents. It makes copy/paste to a place like wordpress semi-functional.