Closed Fabian42 closed 10 months ago
https://github.com/Qalculate/libqalculate/issues/122#issuecomment-451855022
It's random integers, if a value is passed to the function.
I know what it's SUPPOSED to do, but what it actually did was outputting 2 the first time, then 1, then 2, then 1, then 2, then 1 and so on. That's a bug.
The result is only added to the history list if the expression or the result differ from the previous item, thus if rand(2) is calculated 100 times in a row, the results in history will alternate between 1 and 2, but will contain less then 100 values. An exception has now been added for functions generating random numbers.
Aaahh, okay, that explains it! I guess I just didn't notice when I pressed Enter and saw absolutely no change, or subconsciously blamed it on lag or wireless keyboard or so.
I just executed
rand(2)
100 times and it always alternated between 1 and 2. The probability of that actually happening randomly is <.0000000000000000000000001‱, so either this is a bug or I should start buying lottery tickets. The same happens withrandbetween(1,2)
.rand(3)
andrand(2,2)
seem to behave better andrand(2)
works properly in the command line, just not 2 values in the GUI program (version 4.8.1).