Base serialization code for ListRand