@Sir.Hedgehog It's the comparator vs comperable debate.
The sorting function is determined by what you pass to .sort(), a comparator
And not on what's in the array, (i.e. a number)
Because you can't reasonably determine what types are the elements in the array in JavaScript.
It isn't like Java, where you have List<Integer> and you're assured that the list will only have integers, so you can use the Integer's compare() method
They could have went with a different sorting function, but then sorting strings would have been awkward by default, and we'd have the same discussion about strings :)
ok im really confused right now. i was trying to fix sth for someone and i came up with this. can you see the code and freakin tell me, why once in 50 results or so there is a number generated which is less than min? codeshare.io/5XnR9E
the params are always the same, i chekced. but still it occurs that a num with one less digit is generated. could it be a flaw of the Random class?
i know the example is stupid, point was to help him make a random number with a given range of numbers.
I don't have to, the chance is simply greater that it is a result of misunderstanding rathe than a bug in an ancient class used by the entire world of Java programmers.
@Wietlol The first one defeats itself because you already asked something, the second one is actually useful, and are you free to discuss means do you have time to discuss this in more detail?. So actually, neither of those three are the same
Regardless, it pretty much avoids the main problem: singling out specific people. That defeats the purpose of this chat room. You don't have to, if someone is willing and able to answer a question they will. Whether it is the majestic Wietlol or the lowly peon sir Gimpalot.