Random motility of swimming bacteria in restricted geometries