Let L0 be the algebra of equivalence classes of real valued random variables on a given probability space, and (L0)n the n-ary Cartesian power of L0 for each integer n≥2. We consider (L0)n as a free module over L0 and study affine geometry in (L0)n. One of our main results states that: an injective mapping T:(L0)n→(L0)n which is local and maps each L0-line onto an L0-line must be an L0-affine linear mapping. The other main result states that: a bijective mapping T:(L0)n→(L0)n which is local and maps each L0-line segment onto an L0-line segment must be an L0-affine linear mapping. These results extend the fundamental theorem of affine geometry from Rn to (L0)n.