Replying to @nim_lang
@nim_lang spot the differences...
#python
from random import choice
t = ""
s = " ▁▂▃▄▅▆▇█"
z = 0
for i in range(5000):
z += choice([-1, 1])
if z < 0:
z = z + 2
elif z >= len(s):
z = z - 2
t += s[z]

print(t)

Feb 6, 2022 · 9:25 PM UTC

1
5
21
Replying to @pietroppeter
@nim_lang (to copy and paste)
import random, unicode
randomize()
const
l = 5000
s = "▁▂▃▄▅▆▇█".toRunes
var
t = newStringOfCap(l)
z = 0
for i in 1 .. l:
z += sample([-1, 1])
if z < 0:
z += 2
elif z >= static len(s):
z -= 2
t &= s[z]

echo t
0
0
2
RepliesRelevant