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.
Thank you!)
Thank you! 😉
Golang translation 🕖🕜🕧
you should open a
suggestion
in the kata's discourse page, with a link to the translation. Kata authors can approve translations of their own kata; if they have been inactive in the past month, users with more than 4,000 honor can approve themI've added a translation to another kata. Could you take a look at it? I don't know who can approve translations. Would you approve it?
Thank you very much for the explanation. I have already familiarized myself with the Go documentation and now know a bit more about working with the "math/rand" package :)
1
to10,000
). The upper bound can be safely ignored though: testing large strings adds nothing to the task and only makes it harder to debugtime.Now()
in Go).However, apparently, as of Go
1.20
, it is not necessary to call seed anymore: the language will ensure that the RNG is seeded randomly at program startup. Before Go 1.20, the seed was1
by default.I removed the rand.Seed() function because the documentation says that the function is deprecated, verbatim:
Link: https://pkg.go.dev/math/rand#Seed
Also, could you tell me what the Preloaded tab is for?
Could you please help me understand the rand.Seed(time.Now().UnixNano()) function? I have run some tests locally without using this function. I called rand.Intn(50) 10 times in a loop and each time I ran the programme I got a different set of numbers. In this case, I can't understand why forums recommend using the current time to get different sets of data. I will be really grateful for your explanations.
Your remarks were absolutely fair. I have taken your advice into account and made the appropriate changes.
The original kata also has an unnecessary line:
The rand(2, 8) function will never execute.
Yeah, I forgot about that tab. Already fixed it. Thank you!
50
or sorand.Seed(time.Now().UnixNano())
for every string: it is better to put that line in the random tests block, out of the loopreturn 0
) so that it compiles. It is customary on Codewars to avoid that the initial code crashes / fails to compile, so that solvers can immediately try the code to see how the tests workgood, but you forgot to add the message to the sample tests too
Loading more items...