Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Random Algebra

Name: Anonymous 2016-08-05 16:07

Given functions
f(a,b) = random(a) < random(b)
and
g(a,b) = a < random(a+b)

which if of them is more likely to result into 1, if random(n) returns arbitrary number in range of [0;n)?

Justify your answer.

Name: Anonymous 2016-08-07 7:21

random(a + b) = random(a) + random(b) <-- Unproven
a < random(a) + random(b)
= a - random(a) < random(b)
= random(a) < random(b)

(defun random-a+b (n)
"By how much larger is random(a+b) than random(a)+random(b)?"
(float (/ (loop for a from 1 to n sum
(loop for b from 1 to n
summing (- (random (+ a b))
(+ (random a)
(random b)))))
(* n n))))

* (random-a+b 10000)
0.8115202

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List