The random number generator is rarely the limiting factor in computational science. RNGs are usually quite simple and fast, a few dozen instructions, really. If you are doing anything even remotely complicated in your code with these random numbers, then the bottleneck is there.


At the moment, you aren't tracking the number of times a walk reaches zero or even if a walk reaches zero at any point. Your Move function returns the last position of the walk, so you are only checking whether the 1000th step is zero. You should change Move to store the count of how many times that walk reaches zero. You can then determine the mean and ...


You are only moving in one direction for each axis. coin_x = random.randint(1,2) # Move on x axis if coin_x == HEAD: b[step,0]+=1 elif coin_x == TAIL: b[step,0]-=1 # Move on y axis coin_y = random.randint(1,2) if coin_y == HEAD: b[step,1]+=1 elif coin_y == TAIL: b[step,1]-=1 ```


I fixed the compilation issues in the Roulattice package you mentioned and it now compiles and seems to do stuff. Most of the issues were easily solvable, though there's an uninitialized memory error that occurs if you don't use the -torsion flag. Run it like below. ./roulattice -tetra_saw1 50 -num 1000 -torsion The updated repo is available on my Github at:...

Only top voted, non community-wiki answers of a minimum length are eligible