Transferring the DNA of bacteria from generations
Haskell -- 349

import Control.Monad
import System.Random
import Data.List
a=[0,1,2,3,3,1,1,2,0,0]
b=[a,a,a,a]
f 3 _=randomRIO(0,3)
f _ 3=randomRIO(0,3)
f x y=return$div(x+y)2
z::[Integer]-&gt;[Integer]-&gt;IO[Integer]
z x y=zipWithM f x y
c=filter(\x-&gt;length x==2).subsequences
r=sequence.map(\x-&gt;z(x!!0)(x!!1)).c
y=foldr(&lt;=&lt;)return.replicate 20
main=y r b&gt;&gt;=mapM_ print


Try it online with nicer looking source code: http://ideone.com/9FUMLd

The online example does only till 2 instead of 20 because of ideone's time limit.