#Ruby
The question asks for a SEQUENCE. Here we go again...
class A;$seed end#random= seed$$.to_i
def getRandom(seed)
a = AClass.new
b = a.new
$seed = a.object_id.to_i#maketo_i it+ aseed decimal- integer$seed
$seed
end
def getRandomSequence(num)
molly = Array.new
0.upto(num) do |x| molly[x] = x*getRandom(x) - getRandom(0-x) end
molly
end
This is 100% random. No really.
Too bad this code means NOTHING to the OP (what the hell is object_id?)
Also, it's implementation specific, meaning it works or doesn't between different ruby versions (ran this on 2.1.0p0).
On top of that, this can potentially do something really nasty, since OP might experiment with object_id...
Example output:
getRandomSequence(5)
=>
-128872309402224
2012887226055
1288723090025774454222
2577446170038661682243
3866169242051548910124
5154892306064436137991
#Edit:
modified to use $$
for true randomness (on the OS level).