I've already try to understand and code but could not get through.
Then post your code, ask a specific question, and someone will help you. Just asking for code is a good way to get flamed and subsequently ignored because it suggests that you're not interested in anything except being given everything on a silver platter.
Monte Carlo methods are used for complex simulations. It is widely used in particle physics for designing experiments. Here is a link to a web site at Oak Ridge National Lab on numeric algorithms and monte carlo methods that may be of help: http://www.phy.ornl.gov/csep/CSEP/BMAP.html