Ad
  • Default User Avatar
    • Testing for 'tHese guIdElineS aRe deSIgneD tO Be CompAtiBle wItH joe cELKO’s sql prOGraMming StYLe boOk' and 'These guidelines are designed to be compatible with Joe Celko’s SQL Programming Style book' being the same base string
    • Testing for 'tHese guIdElineS aRe deSIgneD tO Be CompAtiBle wItH joe cELKO’s sql prOGraMming StYLe boOk' to be actually random

    sample: tHese guIdElineS aRe deSIgneD tO Be CompAtiBle wItH joe cELKO’s sql prOGraMming StYLe boOk

    Expected: true
    Actual: false

    for sample test case.

    Also I am not pretty sure if my code does what I meant.

    std::default_random_engine prg; // prg stands for pseudo random generator 
      std::uniform_int_distribution<int> int_distribution(0, 9);
      
      for (int i = 0; i < x.length(); i++) {
        int random = int_distribution(prg);
    

    this was meant to give random number every iteration, and therefore create random case.
    But when I recompile my program I see, that in every single compilation those numbers, are exactly the same. Like drawing them happens only one time. Therefore my "random case" is random only for first compilation, and then it looks exactly the same after another compilations. At least it looks like in my OS - Mint, GCC 5.4.0

    phh, I guess I have to find another way to generate "random" numbers ;]

  • Default User Avatar

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

  • Default User Avatar

    after 3 months it is still broken ;<

  • Default User Avatar

    Thank you so much for your reply! So there is no reason to reivent the wheel trying to write some code on your own, which have same functionality as this already written and saved as functions in language libraries, right? I gotta trust that if there is built-in function it is most efficient and most safe for all purposes, is that correct?

  • Default User Avatar
  • Default User Avatar

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

  • Default User Avatar

    No I don't. I pass sample input, and most of random tests, but there is always one that stops me.

  • Default User Avatar

    treat this as a part of practicing. You aren't always getting super-duper perfect clear docs, are you?

  • Default User Avatar

    Hi - Python here.

    I pass loads of random tests, but there is always one that stops me. When I run my code in other interpreters everything looks fine, output is correct. What can I do to make my code pass random tests? How can I debug, so I can see what is output of my code here, in CodeWars interpreter?

    If you have any idea, please help me.
    I appreciate, thank you, xoxo.

  • Default User Avatar

    'even numbers must be on their places'

    while attempting I am getting this:

    #INPUT:
    [1, 20, 2, 28, 3, 5, 7, 9, 18, 50, 11, 74, 13, 52, 15, 56, 44, 78, 72, 17, 24, 0, 19, 26, 38, 21, 36, 23, 10, 88, 25, 66, 70, 54, 27, 6, 60, 29, 31, 33, 35, 92, 37, 39, 41, 40, 43, 76, 45, 47, 49, 86, 22, 51, 53, 16, 90, 8, 68, 55, 57, 59, 96, 98, 80, 61, 64, 63, 58, 32, 65, 67, 14, 69, 71, 73, 48, 75, 77, 30, 79, 4, 42, 82, 81, 83, 85, 62, 87, 12, 89, 91, 46, 84, 93, 95, 34, 97, 94, 99]
    should equal
    #OUTPUT:
    [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99]

    how is that possible? Why even numbers are just erased from ouput array?

    I am doing Python btw.