This sample size is really small. I ran 100 million simulations in Nim[0] (takes around a minute). And distribution converges toward 9.09% on all positions equally:
Average turns: 65.99609065001634
Final position distribution:
4: 9.095%
11: 9.093%
7: 9.091%
3: 9.091%
10: 9.090%
9: 9.090%
1: 9.090%
8: 9.090%
2: 9.090%
6: 9.090%
5: 9.089%
0: 0.000%
> After 5000 runs, they were all 8.4-9.7%
This sample size is really small. I ran 100 million simulations in Nim[0] (takes around a minute). And distribution converges toward 9.09% on all positions equally:
[0] - https://play.nim-lang.org/#pasty=hwdfbsfh (reduced amount of runs to not abuse playground server resources)Shouldn't the code say:
Or have I misunderstood something?The +12 there is so that % works correctly (ie the number never becomes negative)
The +12 is to keep the number positive. The direction contains the movement so a +1 wouldn't make sense.