#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)
t='';
s=[...' ▁▂▃▄▅▆▇█'];
z=0;
for(var i=0;i<5000;i++) {
z+=1-2*(Math.random()*2|0);
if(z<0){z=z+2;};
if(z>s.length-1){z=z-2;};
t+=''+s[z];
}
t;

Feb 6, 2022 · 11:18 AM UTC

3
11
106
Replying to @justvanrossum
Let it be known that using += to build a string is generally slower — scales worse — than appending items to a list and joining the parts at the end.
0
0
11
RepliesRelevant
Replying to @justvanrossum
@justvanrossum This random walk output has an organic feel, suggesting that there is signal in the noise, when in fact, there is none.
0
0
4
Replying to @justvanrossum
@justvanrossum Hey is that the van Rossum who did the Beowulf typeface?
0
0
0