From Rosetta Code
Latest comment: 6 years ago by Eoraptor in topic C task

C task

There is a minor problem: the program should print another random number before restarting the loop.

There is a very annoying problem: see Talk:Pick random element, where there is an identical fundamental mistake in the C program. While neither of the tasks states explicitly that the distribution has to be uniform, it seems to me that it's implicit in the question.

The solutions given for several other languages use a bad method to generate the random numbers. I understand that for this task it's not fundamental, but then at least it should be stated somewhere that the method is poor.

Eoraptor (talk) 22:30, 26 August 2017 (UTC)Reply[reply]


The second example is incorrect. First, it will not loop indefinitely. Secondly, it produces numbers outside the 0 to 19 range. The first example is correct. Superstitionfreeblog (talk) 02:55, 23 October 2023 (UTC)