{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lecture21

# lecture21 - PSEUDORANDOM NUMBERS CSci 5403 COMPLEXITY...

This preview shows pages 1–3. Sign up to view the full content.

1 COMPLEXITY THEORY CSci 5403 LECTURE XXI: FORMAL FOUNDATIONS OF PSEUDORANDOMNESS PSEUDORANDOM NUMBERS In C we call rand() to get “pseudo”-random bits. static int x; int rand(void) { x i+1 = ax i + b mod p; return x i+1 ; } And we call srand(int x) to set x. Where do the random bits in a PPT come from? Do these bits “look like” random bits? STATISTICAL TESTS A statistical test tries to find something non- random about a sequence of values e.g. Given m samples x 1 … x m of elements in the range {0,1,…,p-1}, count occurrences: value 0 1 2 p-1 #seen 10 12 8 11 If too many (> 2 m/p, say) in any slot, “fail.” otherwise “pass.” The “ χ 2 test” for a uniform random variable Definition. A sequence generator is an efficiently computable function that takes a short initial sequence to a longer output sequence. Example. C’s rand() is a “linear congruential generator”, e.g. it takes x 0 x 0 x 1 …x i using the rule x i = ax i-1 + b mod p Example. The repeated squaring generator G N (x) = b 1 b 2 …b , where x i = x i-1 2 mod N, and b i = x i mod 2

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 APPLICATION: GAME-PLAYING Paper, Rock, Scissors P R S P 0 1 -1 R -1 0 1 S 1 -1 0 If Bob knows Alice will play P, R, or S each with probability 1/3, he should too. What if Alice uses an LCG (mod 3) to choose her moves?
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 6

lecture21 - PSEUDORANDOM NUMBERS CSci 5403 COMPLEXITY...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online