finished data generation code, project 3 aa228