6 ms·
I gave ChatGPT (GPT-4) the code to the generator and asked it for its thoughts. It responded: == Begin quote == INTERCAL is a esoteric programming language de
by LeoPanthera 3y ago
I gave ChatGPT (GPT-4) the code to the generator and asked it for its thoughts. It responded:
== Begin quote ==
INTERCAL is a esoteric programming language designed to be as different from conventional programming languages as possible. It's known for its obfuscation and convoluted syntax, and your provided program adheres to this style perfectly. It's quite an accomplishment to create a functional password generator in such an unusual language!
Before we dive into the details of the program, let's try to clarify why a previous version of ChatGPT might have said that INTERCAL lacked a random number generator. That statement may be somewhat misleading. It's not that INTERCAL inherently lacks the ability to generate random numbers, but it doesn't provide a straightforward, built-in function to do so. Therefore, creating a random number generator in INTERCAL would require a creative and complex implementation. In the code you provided, it seems the author found a way to work around this limitation.
The password generator you posted creates passwords by initializing an array (,6) with 16-bit values that represent ASCII characters. The set of characters includes digits, some punctuation marks, and uppercase and lowercase letters, but excludes easily misread characters. It creates a 16-character password using these values, and it seems to enforce a certain level of complexity by ensuring the inclusion of at least one number and one punctuation mark.
The main loop begins at `(1) DO COME FROM (9)`. Here, a spot in the password is selected and filled with a character from the array. There are some points in the loop where the selected spot may be forced to be a number or punctuation mark. If the character set is checked for digits and punctuation marks, pre-chosen spots for these types of characters are dropped. The selected character is then read out.
This INTERCAL code uses a clever trick to generate seemingly "random" numbers - using the `%50` operation (which in INTERCAL means to mingle the bits of two 16-bit numbers), along with unary operations like `#1`, `#2`, `#4`, etc. on the same variable, to generate different results each time the loop is run.
While I must say this is an ingenious solution, it's not a truly random generator, and the randomness of the password depends heavily on how INTERCAL handles the `%50` operation and the subsequent operations on the same value. It's more of a workaround that takes advantage of INTERCAL's quirky way of handling operations than a typical random number generator.
Nevertheless, creating such a program in INTERCAL is quite a feat. The author deserves credit for coming up with such a complex solution in a language that deliberately eschews conventionality.
== End quote ==
- breadbox 3y agoAnd again, a heady mix of accurate observations with complete bullshit. Separating out the misinformation is, as always, left as an exercise for the reader.
- ConceptJunkie 3y agoWhich means it's significantly better than your average news outlet.
- omnicognate 3y ago> This INTERCAL code uses a clever trick to generate seemingly "random" numbers - using the `%50` operation (which in INTERCAL means to mingle the bits of two 16-bit numbers), along with unary operations like `#1`, `#2`, `#4`, etc. on the same variable, to generate different results each time the loop is run. I don't know INTERCAL but this appears to be pure bullshit. Wikipedia's description of `%50` is consistent with the article author's: "after the identifier, a percent chance of the line executing can be given in the format %50, which defaults to 100%." [1] And contrary to GPT-4's doubling down on INTERCAL not containing any random number support, a built in language feature that executes (or not) a line of code with a chosen probability really is random number support built into the language, just with a deliberately bizarre interface in keeping with the rest of the language. [1] https://en.m.wikipedia.org/wiki/INTERCAL https://en.m.wikipedia.org/wiki/INTERCAL
- TeMPOraL 3y agoThe mention of choice points a sentence earlier plus... well lack of anything explicitly stating here that RNG is involved, makes me think it may not be - or at least that it may not be required. The thing might just as well be fully deterministic, reproducing the exact same striped yes/no pattern each time, with the right duty cycle to add up to the percent chance. If that's the case, you still could build a PRNG out of it with enough code, but that's the same thing as building PRNG out of regular math (%-operator would then be equivalent to hardcoding 100 100-bit constants). However, I would not call %-operator itself a (P)RNG or a randomness primitive. Unfortunately, the linked reference in [5] is in PostScript format, and I have... exactly zero devices that can open that quickly, so I can't check. But I strongly hope I'm right, just so I can smirk at all the people, author included, who criticize ChatGPT for insisting %-op isn't a RNG, while forgetting about https://xkcd.com/221/ https://xkcd.com/221/.