changed RandomTest and added Flatmap testing