Back to General discussions forum
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
There is no unsuccessful solution saved for this problem for you, thus we need more details please.
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.
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
You use i%2
to check for even or odd positions. Think about whether this is the right check.