52
Testing random code

Testing random code

5 years ago
Anonymous $Dftgs0JzgE

https://medium.com/@anastasisgeorgoulas/testing-random-code-5e2a64a5b74

If there is one certainty about writing code for computational research, it is that rerunning the code will give you different results.

A joke, of course — but it does contain some truth. While this can sometimes be due to oversights (such as a different environment or accidental code changes), other times the difference is not only to be expected, but intentional! For example, simulation algorithms, like those used in various types of computational modelling, are often non-deterministic: they want to perform different computations each time, to explore different possible events that can happen. This is achieved by relying on a random number generator (RNG), another algorithm or framework that, when requested, will produce numbers in a way that is difficult to predict — hence, essentially random. These numbers effectively form part of the main code’s input, ensuring it runs differently each time. In this case, the varying output is an integral part of the code’s intended behaviour. Unfortunately, it complicates things when it comes to reasoning about it.

Testing random code

Feb 3, 2019, 9:18pm UTC
https://medium.com/@anastasisgeorgoulas/testing-random-code-5e2a64a5b74 > If there is one certainty about writing code for computational research, it is that rerunning the code will give you different results. > A joke, of course — but it does contain some truth. While this can sometimes be due to oversights (such as a different environment or accidental code changes), other times the difference is not only to be expected, but intentional! For example, simulation algorithms, like those used in various types of computational modelling, are often non-deterministic: they want to perform different computations each time, to explore different possible events that can happen. This is achieved by relying on a random number generator (RNG), another algorithm or framework that, when requested, will produce numbers in a way that is difficult to predict — hence, essentially random. These numbers effectively form part of the main code’s input, ensuring it runs differently each time. In this case, the varying output is an integral part of the code’s intended behaviour. Unfortunately, it complicates things when it comes to reasoning about it.