Random Number - testing for even/odd

I want to introduce some random "navigation" into my course. My plan would be to generate a random number (I've done some playing and got this to work), but what i want to do is then test that number for being even or odd and jumping to one of 2 possible pages depending on that test.


Can Lectora test for even/odd? How could that be accomplished?



In previous experiences with programming we would generate a random number, then test if that number could be divisible by 2 and checki f the result is a whole number/integer or if there is a decimal. Does Lectora work in the same way or there some other hoops to jump through to see if it is a whole number?


Example: loading Page 1 generates a random variable, clicking the next buton then has an action that tests for the even/odd and jumps to page 2 if even and page 4 if odd. The storyline would be: testing if my character's computer could load a software program based on the computer specs and the required specs of the software. Jumping to page 2, the specs would match up fine for loading the software and the quiz on page 3 would be "yes it could load the software", if it jumped to page 4, the specs wouldn't align and the quiz on page 5 would be "no the software can't be loaded".

Discussion (3)

As far as I know, Lectora doesn't have a way to test this natively. However I believe with some javascript it could be done.


I don't have any experience with using javascript with lectora variables, but there should be some other folks on here who could direct in what to do!

So you need a 50/50 random coin flip, basically? Generate a random number in the interval, say, 0..100, and test if it's over 50 or below 50. The go to page A if it's below or page B if it's above 50. You don't need to test for odd/even at all.

Hmmm... that a different way of thinking about it, I guess I really just need it to be one thing or another - I'm just just using 2 outcomes, so testing high or low would be a simple way to accomplish what I need.


Thanks!



Just for future knowledge, anyone know if you could still test for even or odd?

Discussions have been disabled for this post