72 - Funny Words Generator

Back to General discussions forum

CurioFibo     2022-11-09 20:51:59

I can't understand why my output from my algorithm didn't come out as expected. I couldn't find and fix the error.

Thanks in advance,

CurioFibo

gardengnome     2022-11-09 20:55:59
User avatar

There is no unsuccessful solution saved for this problem for you, thus we need more details please.

CurioFibo     2022-11-10 11:38:12

Sorry, I thought I posted my code. I will be doing it now.

Thank you very much!

CurioFibo

gardengnome     2022-11-10 17:55:58
User avatar

Have a look at your linearCongruentialGenerator method. For the example discussed in the problem, it produces a list of three random values. These values match the first three random values shown in the example. But the example illustrates that you need 4 random values alone for generating the first word, and there are more words after that. That means your logic isn't quite right - you need a new random value for each letter of each word.

CurioFibo     2022-11-10 19:50:19

I made some adjustments to my algorithm but the outputs still don't give the correct answer. Some words come out as expected but others don't, they keep giving error.

Thanks in advance,

CurioFibo

gardengnome     2022-11-10 20:29:49
User avatar

You use i%2 to check for even or odd positions. Think about whether this is the right check.

Please login and solve 5 problems to be able to post at forum