In my diploma thesis I present computer simulation based on the Monte Carlo method. In the beginning I describe the method and some history behind it. I also present its components, which are important for using the method. In the following chapter, I present some simple examples of computer simulations. They are organized by difficulty, from basic to the more complicated ones. These examples are: calculating the mathematical constant π, random walk in one dimension, random walk in two dimensions, and neutron reflector. After that I introduce the main problem of the thesis, light scattering in the atmosphere. I describe the problem and its implementation in the computer simulation in detail. Using the results of my calculations I explain why the sky is blue when the sun is in the zenith and also why the sun is red at the sunset. I also made a picture of the sky and of the sun at the sunset, which are coloured according to the results of simulation.