# Tag Info

4

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.

1

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 `

1

Bit-twiddling is sometimes used as part of the numerical algorithms that are apropos for this site (e.g., hardware implementations of the Fast Fourier Transform, simulation of quantum computers, etc.). Some resources that come to mind: D. E. Knuth, The art of computer programming. Vol. 4A. Combinatorial algorithms. H. Warren, Hacker's delight. https://web....

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