• Add console.info(prev/Math.pow(2,32), prev/Math.pow(2,32) * 26 + 65) in the middle of the the iife's random function, then run it and see if you can figure out what's happening. ;-)

    (function () { 
      function random() {
        prev = (multiplier * prev + increment) % modulus;
        console.info(prev/Math.pow(2,32), prev/Math.pow(2,32) * 26 + 65)
        return prev/Math.pow(2,32);
  • Your wording is fine! I should have done a better job of reading.

    However, an example would have actually cleared it right up for me (and I was actually disappointed there wasn't one to reference).

    For example:

    const ted = new Bouncer({ minAge: 18, guestList: ["Lo", "Mc"] })
        { name: "Joe", age: 6 },
        { name: "Lo", age: 3 },
        { name: "Hugh", age: 33 }

    returns: [ { name: 'Lo', age: 3 }, { name: 'Hugh', age: 33 } ]

  • This comment is hidden because it contains spoiler information about the solution

  • @Lazy Cat - Each kata has a discussion area, and you should post your questions and comments directly to that discusison area. In addition, since you're showing code, you should mark your comment as a "Spoiler" so that you aren't showing that code to other people who are also trying to train on that kata.

    The discussion area for the kata you're having issues with is https://www.codewars.com/kata/583203e6eb35d7980400002a/discuss/php

  • @AcesOfGlory - Thank you. It's always the little things that trip me up the worst. :-(

  • Something is definitely schizophrenic!

    The problem is that each of those was a working solution for a previous version of the kata. Another user ran into a problem trying to solve the kata, and in trying to figure out if their problem was because of my tests, all the previous solutions suddenly become "Invalid Solutions" HOWEVER THEY ALL VALIDATE (i.e. pass all the tests) within the Kata editor! (It's "schizophrenic" enough that I even pinged Voile (who previously helped) in the gitter channel asking for help - https://gitter.im/Codewars/codewars.com/kata-authoring-help?at=596cf78689aea4761da984d5 )

    edited to add: It looks like JohanWiltink's solution eventually passed, but OverZealous' and Voile's solutions, WHICH PASS in the Kata Editor are still being marked as "Invalid Solutions" here. >:(

  • This comment is hidden because it contains spoiler information about the solution

  • Please provide more information on the expected error for an empty array.

  • It looks like it has something to do with the node version. Everything works hunky dory in Node v6.11.0/Babel, but even the simple versions are failing in Node v8.1.3. Unfortunately I'm not going to have a lot of time to work on it until tomorrow evening, so I'm going to un-publish it for the time being.

    I'm curious if v8.1.3 is giving anyone else problems?

  • 2 years later and it's still confusing!

    I'm glad I'm not the only one confused.
    Also, thank you for the Codex!

  • 2 years later and it's still confusing!

  • @smile67 - When I run just the empty starter function (i.e. below), I just get normal old test fail messages no actual errors. Will you please post exactly what you tried to submit?

    function findOutlier (intArr) {
  • @Unnamed - Well that was an embarrassing typo!

    Please let me know if the revised description doesn't resolve your issue.

  • @smile67 , @St3f4n, @myjinxin2015 - Thank y'all for bearing with a lower level, first time kata writer!

    If you get a CodeWar's message about problems that "may also be caused by inefficent code" OR if all but the last test pass and you get a "FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory" error for that, then the problem is likely your code. If your error is not one of these two, please let me know! (Ideally include the error and your proposed solution with a "spoiler" flag.)

    For what it's worth, I intentionally added some resource load to eliminate a class of potential solutions that aren't performant. I'm sure there are better ways to achieve the same goal - I just don't know what they are!

    @Voile - I'm not actually generating an array of size Number.MAX_SAFE_INTEGER - 1, I'm generating a const safeButVeryLargeArraySize = Math.floor(Number.MAX_SAFE_INTEGER / workingDivisor), as mentioned at length in the comments around that line, I'm sure there's a better way, but I don't know what it is. 😔 I'm very open to suggestions and I very intentionally left this kata open for contributions. 😉 At the end of the tests themselves, I've added two example solutions that should not pass. (And for what's it's worth - I love your solution! For me, code like that is the delicious prize that I get to enjoy after completing katas!)

    @Chrono79 - Thanks for the chuckle! I believe in challenges for learning, not torture or humiliation for other's entertainment. But the idea was still chuckleworthy.

  • Note that this solution has a lot more 'Clever' upvotes than 'Best Practices' upvotes. This is an indication that the community doesn't necessarily think it's a actually a "good" solution.

    This is in fact, one of the rare times that I wish we also had some downvote capability. I gave it an upvote for 'Clever', but I really want to give it a downvote for 'Best Practices'.

    I initialy was going to upvote naomik's response, but there's no need to call it a "moronic" solution. Pointing out (potential) problems with solutions is very appropriate, name calling and derogatory comments aren't. This is a community for learning, not insulting.

  • Loading more items...