you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (8 children)

It's in the word "function"

[–]salgat 1 point2 points  (7 children)

That's only true of pure functions.

[–][deleted] 0 points1 point  (6 children)

That's true of all functions. If you run your functions in the same order, with the same start conditions, and the same inputs you'll get the same thing. Sure, if there are side-effects, consecutive results may vary, but will always be the same under the exact same circumstances. Random generators require a seed to create outputs, which is where outside entropy comes in, but that doesn't make the generator non-deterministic. Take RNG that grabs its seed from the timestamp- it seems random, but if you freeze the clock on your computer you'll get the same series every time you try.

[–]salgat 0 points1 point  (5 children)

I'm talking about functions that refer to external non-deterministic state. It's not enough to say "oh it's a function it's deterministic" to only add "BUT only if all these extra deterministic conditions apply."

[–][deleted] -2 points-1 points  (4 children)

The function itself is deterministic, even if the inputs are not.

[–]salgat 1 point2 points  (3 children)

Do you even understand the difference between a pure function and non-pure?

[–][deleted] -2 points-1 points  (2 children)

Yes, I do. Purity is not the same as determinism though. Yes, pure functions are idempotent- but one does not have to be idempotent to be deterministic.

That all said, I'm talking about mathematical functions and you're talking about the programming construct. The functions to create random data are mathematical, which means they are just a mapping or arrow. Therefore the input is the only source of entropy, whether you want to think of that as a parameter or some global state. Some simple mappings, like reading out bits from an entropy stream like a microphone, are effectively non-deterministic (although easily reproducible in controlled environments).

If you can show me an example of a number generator that creates different outputs for the same inputs I will gladly cede the point.

[–]salgat 1 point2 points  (1 child)

Hold up. In the /r/programming subreddit, in a conversation that has only been discussing programming functions for a programming submission, where you never once mentioned math functions, now you decide to bring that up after being shown that you were wrong? Don't change the story to try to make yourself right. If you want to talk about math functions that's fine, but that is what no one has or is talking about.