Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
I think there is 1 such kata (can't find it).
is there a kata that has excellent random distribution checking?
I was able to solve using
Math.random
and not implementing my own algorithm.I don't think this is an expected behaviour, passed using Java.
hard to tell with codewars diffs being what they are, but I think you messed up the description
uhm, no? no.
Crystal translation severely misuses testing framework and uses
it
blocks in a totally wrong way.Nice one, well done, congratulations for the kata.
C#
There's a problem with the tests checking even distribution - my passed solution is definitely not providing an even distribution...
Having had a look at the relavent test in the Sample Tests, I think its a simple integer division issue:
This checks for the distribution on '1's:
Assert.Less(Math.Abs(Integers.GetValueOrDefault(1, 0) / Length) - (1 / 3.0), Threshold);
However the number of 1s held in Integers.GetValueOrDefault(1, 0) is not being cast to double. Therefore when its divided by the total number of digits held in the integer Length, it comes out to 0. And since the Asserts are only failing when they find a proportion greater than 1 / 3 (which would be fine if the first calculation was correct), its passing everything.
Casting Integers.GetValueOrDefault to double in each Assert should fix it I think.
approved
It was defensive, I'm guessing you feel personally attacked as your update has allowed this loophole. Sorry it wasn't personal but the idea of getting annoyed at a user because you left a loophole seems naive to me...
I haven't been coding long but I've enjoyed solving these little problems on CW and I've learnt a lot thanks to it but if this is enough to get banned I don't really care.
Hopefully somebody comes along with better update that closes this and I'll have another go in the future. It looks like another commenter may have done just that but I'm not skilled enough to say whether everything is fine.
Anyway thanks for making my first attempt at feedback such an unpleasant experience, with any luck the next time will be better or I just won't bother. Maybe you should have a think about what actually makes CW a worse place?
Could you check this fork?
Oh, that wasn't defensive, that was full-on offensive. I was calling you a cheat.
This kata was authored when restricting
Math.random
was possible. Maybe it should be retired, instead of updated to the current version, after all. And maybe you should just be banned.ETA: I did not much expect, but at least hope, that people would actually read the description, and follow instructions. Why would you insist on making CW a worse place for everybody, where restrictions have to be enforced? Why do you feel the need, the need to cheat?
if the tests pass then I don't see how you can expect this to not happen.
I thought the feedback might be useful, no need to get defensive.
Could anyone recommend some topics to study to understand this?
This comment is hidden because it contains spoiler information about the solution
Loading more items...