7 ms·
You can match the spirit of it pretty closely with Perl. perl -C -e '$|++;X:print chr(9585.5+rand());goto X'
by tyingq 9y ago
You can match the spirit of it pretty closely with Perl.
perl -C -e '$|++;X:print chr(9585.5+rand());goto X'
- gravypod 9y agoPHP too php -r "TEN: print(chr(47 + 45 * rand(0,1))); goto TEN;"
- laurent123456 9y agoWhy "9585.5", is that a particular unicode character? That only displays squares on my terminal. I've tried to replace this with 205.5 like in the example but that would only display Î or Í.
- tyingq 9y ago9585 is ╱ 9586 is ╲ (both mentioned elsewhere in the thread by their hex equivalents 2571 and 2572) Try a different terminal maybe? Works in xterm, xfce, etc, for me. Also, I have LANG set to en_US.UTF-8 The ".5" is because Perl's chr() will convert it to an int by chopping off the decimal portion. rand() returns a floating point number between 0 and 1. That's very similar to what the BASIC program is doing.
- auselen 9y agoI did this a while back and saved in a gist. I don't remember if it had any problems though. s=╱╲;while :;do printf ${s:RANDOM%2:1};sleep 0.001;done