The Python Decision
We approached the development of this simulation by examining several tools. There were some teams that indicated they would build their simulations in Java, some thought that they would be able to do their in JavaScript, others chose Visual Basic in conjunction with Microsoft Excel.
We examined our situation and understood that we would need to be able to parse the element data out of text files; it would be too time-consuming and inaccurate to attempt to do the same work by hand.
Further, once the text files were parsed, we would want to have a simulation that was capable of creating arrays for each state, and to utilize a random number generator that was robust enough that it could perform adequately, or be able to access random numbers from http://www.random.org/, where we could be assured of truly random numbers.
Thus, we determined that Python would suit our needs.
Python has the functionality to do all of the above, and more, including graphing functionality and the ability to parse files and write to comma-separated-value (.csv) format, which is essential if we were to move between our simulation data and Microsoft Excel.
Which, for our purposes, suits us nicely, to start. As an experiment, we will provide the results from utilizing a very basic random generator, using the Linear Congruential Method, from the Python Mersenne Twister, and from http://www.random.org/This module implements pseudo-random number generators for various distributions.For integers, there is uniform selection from a range. For sequences, there is uniform selection of a random element, a function to generate a random permutation of a list in-place, and a function for random sampling without replacement.On the real line, there are functions to compute uniform, normal (Gaussian), lognormal, negative exponential, gamma, and beta distributions. For generating distributions of angles, the von Mises distribution is available.Almost all module functions depend on the basic function random(), which generates a random float uniformly in the semi-open range [0.0, 1.0). Python uses the Mersenne Twister as the core generator. It produces 53-bit precision floats and has a period of 2**19937-1. The underlying implementation in C is both fast and threadsafe. The Mersenne Twister is one of the most extensively tested random number generators in existence. However, being completely deterministic, it is not suitable for all purposes, and is completely unsuitable for cryptographic purposes.
Although the Python decision was justified, and sound, there were complications, in particular, converting from a pdf format into something that we could parse was troublesome and time-consuming, detracting from the simulation work over-all.
No comments:
Post a Comment