#separator:tab
#html:true
#notetype:Basic
#tags column:3
#deck:cracked.guide::TAOCP Vol 2::3.3.1 General Test Procedures
#columns:Front	Back	Tags
TAOCP §3.3.1 General Test Procedures: what does it cover?	The statistical machinery for testing a generator: the chi-square test for counts in categories, and the Kolmogorov-Smirnov test for continuous distributions, plus how to read their results without fooling yourself.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::3.3.1 cracked.guide::kind::about
TAOCP §3.3.1: why does it matter?	These tests are how you check any claim of &quot;uniform&quot; or &quot;random&quot;, whether it is a PRNG, a load balancer, or an A/B test bucketing scheme.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::3.3.1 cracked.guide::kind::why
TAOCP §3.3.1: what traps should you watch for?	<ul><li>Treating one failed test as proof of a bad generator, or one pass as proof of a good one.</li></ul>	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::3.3.1 cracked.guide::kind::traps
TAOCP §3.3.1, exercise 1 (rated 00): what is it asking?	Which row of the chi-square table applies. Make sure degrees of freedom are second nature.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::3.3.1 cracked.guide::kind::exercise
TAOCP §3.3.1, exercise 3 (rated 23, recommended): what is it asking?	Run a chi-square test on real loaded-dice data and interpret the outcome.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::3.3.1 cracked.guide::kind::exercise
TAOCP §3.3.1, exercise 5 (rated 22): what is it asking?	Compute both KS statistics for a small sample by hand, then check with code.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::3.3.1 cracked.guide::kind::exercise
TAOCP §3.3.1, exercise 7 (rated M15): what is it asking?	Basic bounds on the KS statistics. Quick sanity facts.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::3.3.1 cracked.guide::kind::exercise
TAOCP §3.3.1, exercise 9 (rated 20, recommended): what is it asking?	What extra information the other one-sided KS statistic would have given in the text's experiment.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::3.3.1 cracked.guide::kind::exercise
TAOCP §3.3.1, exercise 10 (rated 20, recommended): what is it asking?	What happens to chi-square if you sneakily count the same data twice. A lesson about inflating sample size.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::3.3.1 cracked.guide::kind::exercise
TAOCP §3.3.1, exercise 23 (rated M22): what is it asking?	Compute the KS statistic in linear time without sorting. A neat algorithm to implement.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::3.3.1 cracked.guide::kind::exercise
TAOCP §3.3.1, exercise 14 (rated HM26, recommended): what is it asking?	Derive the chi-square approximation from Stirling's formula. The stretch.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::3.3.1 cracked.guide::kind::exercise
TAOCP §3.3.1: how many exercises, and how are they rated?	25 exercises, rated 00 to HM48.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::3.3.1 cracked.guide::kind::exercises
TAOCP §3.3.1: what should you be comfortable with first?	<ul><li>Basic probability and statistics</li><li>3.2 Generating Uniform Random Numbers</li></ul>	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::3.3.1 cracked.guide::kind::prereqs
TAOCP §3.3.1: how should you work through it?	Implement chi-square on dice rolls from a good and a bad generator. Implement KS on uniform floats. Run each test many times and see that even a perfect generator &quot;fails&quot; sometimes; that is the point of p-values.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::3.3.1 cracked.guide::kind::approach
