Live data from Hacker News

10 PRINT CHR$(205.5+RND(1)); : GOTO 10 (2012)

10print.org

51–60 of 62 posts

Re: 10 PRINT CHR$(205.5+RND(1)); : GOTO 10 (2012)

#53
post #39
post #18

Earlier quoted context omitted.

Should fix the line height so the lines connect to each other.

which browser doesn't show that right? chrome and firefox have connected lines for me

The lines are not connected here, on Chrome. Maybe it depends on what fonts you have installed?

Re: 10 PRINT CHR$(205.5+RND(1)); : GOTO 10 (2012)

#55

It bothers me way more than it should that this line of code has become known as "10print". Like, 95% of BASIC oneliners out there start with "10 PRINT". It's like calling a McDonald's Super Size Big Tasty Meal With Diet Coke And A Side Salad a "Mac". It should've been called 205.5+RND or something. Grmbl.

It’s like using “Dear” to refer to some particular famous letter.

Re: 10 PRINT CHR$(205.5+RND(1)); : GOTO 10 (2012)

#56
post #42

Earlier quoted context omitted.

RND(1) returns a value between 0 and 1, but always lower than 1. Thus, the result of 205+RND(1) will always be 205 point something, which in turn will be truncated to 205. Thus, it will always result in the same character.

I see. RND returns a float.

It's more that the decimal is always rounded down. So you don't want a value between 205 and 205.9999999, as it'll always be rounded down to 205. you want a value between 205.5 and 206.49999999, so when rounded down it has a (practically) even chance of landing on either 205 or 206.

Re: 10 PRINT CHR$(205.5+RND(1)); : GOTO 10 (2012)

#57
post #33
post #23

Earlier quoted context omitted.

Doesn't quite work on my mac :/

Got it! This works on macOS. It encodes the same characters in hex UTF-8: while true; do printf "\xe2\x95\xb$((1 + ($RANDOM & 1)))"; done

Excellent work! Thankyou, that's awesome and very fast....

Re: 10 PRINT CHR$(205.5+RND(1)); : GOTO 10 (2012)

#58

It bothers me way more than it should that this line of code has become known as "10print". Like, 95% of BASIC oneliners out there start with "10 PRINT". It's like calling a McDonald's Super Size Big Tasty Meal With Diet Coke And A Side Salad a "Mac". It should've been called 205.5+RND or something. Grmbl.

It’s like using “Dear” to refer to some particular famous letter.

That's the analogy I was looking for. Thanks!

Re: 10 PRINT CHR$(205.5+RND(1)); : GOTO 10 (2012)

#60

It bothers me way more than it should that this line of code has become known as "10print". Like, 95% of BASIC oneliners out there start with "10 PRINT". It's like calling a McDonald's Super Size Big Tasty Meal With Diet Coke And A Side Salad a "Mac". It should've been called 205.5+RND or something. Grmbl.

The visual effect it produces is not even portable, even it is tied to a machine's 8 bit extensions to 7 bit ASCII.
Post reply on HN