• Well, ok...

  • This tests requires no approximations, because the output has only integers

  • By unique values I mean values that cannot reappear,

    i.e. if we randomly get a value of 4 from a given array,
    there will still be 4 in that array.

    For example, if we have an array [1,2,2,3,3,4,5] and count = 3, and we randomly get [1,2,4], the original variable 'array' will still have [2,3,3,5];

  • For example: aEqual(Math.log, [27,3], 3);

  • Randomness is not tested.

  • This function is similar to randchoices, but returns an array of unique values (values cannot be repeated).


    The formulation is very bad. It looks like you're not asking for a result that contains unique elements, but for results to be truncated and not go above original array.

  • Since the size of the array is smaller than the value of the 'count' variable,
    the expected array must be the same size as the variable 'array'.

    So Math.randunique([4,4], 4) should return [4,4]

  • Ah, I missed that part. Still, specification should be preferred over examples.

    I'll leave that for the author to decide.

  • Randunique behaviour is not well specified.

    What kind of output do you expect for array = [ 4, 4 ] and count = 4 ? Shouldn't it be [4] ?

    expected false to be true

    Not helpful :/

  • There's a test in the description that covers this, no? If it's a single value passed, then a defaults to 0.

  • Some fixed tests still use strict equality.

  • Fixed

  • Fixed

  • You should probably use an approximate assertion instead of strict equal. I was using Math.log instead of Math.log2

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

  • Loading more items...