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 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.
uhm, no? no.
Crystal translation severely misuses testing framework and uses
it
blocks in a totally wrong way.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.
Could anyone recommend some topics to study to understand this?
Ruby 3.0 should be enabled.
This comment is hidden because it contains spoiler information about the solution
one_two_three': undefined method
oneTwo' for main:Object (NoMethodError)from
block in <main>' from
times'from `'
The instructions give a function 'oneTwo' but this function does not exist in the Ruby version, the function is actually 'one_two' this is misleading.
Especially since "global" variables in Ruby should be prefixed with $ and this is not the case with this kata.
My solution was accepted without the use of the this function, because I saw no way to use this function until solving it and seeing the solutions that used the given function.
This comment is hidden because it contains spoiler information about the solution
I'm not native speaker of English. So I don't understand what is this kata trying to do.
Any example please?
Test specific sequences
Test Passed
1111 must be in sequence
2222 must be in sequence
3333 must be in sequence
Test randomness
sequence must pass randomness testCounter({1: 20000, 2: 20000, 3: 20000}) 60000
Your goal is to create function one_two_three that returns 1, 2 or 3 with equal probability using only one_two function.
If I understand correctly, I have to create function which returns 1, 2 or 3. But I have to return 1111, 2222, 3333 ??