R Programming Homework Solution on Simulation in R