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.
VeryNice!
I am trully love your enterpise soulution
Approved your one. Looks good!
Yeah, I get that, I stumbled across this translation after writing my own here. I wasn't sure if I should look at tidying this up since its been 4 months or publish a separate one. (I thought CW was supposed to warn me if I tried to create another translation for one that was already in progress. Well thats what the wiki said anyway)
My point was that people can easily hack a call like
Math.random()
(without qualified name).kotlin.random.Random.nextDouble()
is obviously a better one.Would it make sense to use
kotlin.random.Random.nextDouble()
for the Kotlin translation since that seems to be more idiomatic to Kotlin thanMath.random()
? Or stick withMath.random()
to keep the translations consistent?Was going to translate this and found this existing translation.
Left some comments, please improve :)
Math.random()
call is vulnerable, please usejava.lang.Math.random()
. Otherwise people can simply hack by creatingobject Math { fun random() }
.Kotlin translation: https://www.codewars.com/kumite/5c12419c8a2d874c9c00006e?sel=5c12419c8a2d874c9c00006e
This comment is hidden because it contains spoiler information about the solution
Already reported. Please scroll a bit further to see my request.
The problem seems to be when any r, g or b value is between 10 and 16 it drops the preceeding '0' eg. 10(dec) -> A(hex) instead of 0A(hex). So a quick fix is to just add a case for when the value is between 10-16 and drop that 0.
Kotlin : The sample tests expect 6 digit hex values but the random tests are expecting 5. A RGB hex needs 6 digits to be valid. This error is only occuring when the value is between 10 and 16, e.g. it will expect 'F' instead of '0F'.
A hack is to put an additional check but it should be this way.