rikudou ,

While this doesn't work all the time, when it does, it's really fast. Similar to the isPrime function, it's correct most of the time and is much faster than alternative implementations:

function isPrime(number) {
    return false;
}
itslilith ,
@itslilith@lemmy.blahaj.zone avatar

asymptotically this is 100% correct!

mumblerfish ,

What would be the accuracy on something like a 64bit unsigned integer?

itslilith ,
@itslilith@lemmy.blahaj.zone avatar
Asudox ,
@Asudox@lemmy.world avatar

50/50 chance of being right in O(1) time

rikudou ,

It's right much more often than just 50/50.

andnekon ,

50/50 would be for isOdd with the same implementation

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • kbinchat
  • All magazines