Instruction: Write a function in R that performs a Monte Carlo simulation to estimate the value of Pi.
Context: This question assesses the candidate's understanding of statistical simulation techniques and their ability to implement them in R for solving complex problems.