Create Loop


I have 10 numbers. I want to randomly select 2 times one number between 1 and 10. But 2 number cannot be the same.


The first part is not difficult, using the action and defining the random number between 1 and 10

Generating a second number is not hard, same principle. Yet, how do I avoid that the first and the second are identical?

I started working with a “loop” where I

  • create an action that compared both numbers and if equal
  • use the sgapiJumpToPage to jump back to generating the second number

Somehow this does not seem to work

Guy Rombouts332071 asked

    thx, it helps anyway!

    Guy Rombouts332071 answered

      It’s difficult to answer without actually seeing your code, but can you test the new random number against the existing random number:

      X = randomNumber
      DO WHILE
      Y = newRandomNumber
      IF X == Y
           X = Y

      Pardon my pseudo-code but I remember using a test like this in my younger days when I had to avoid using the same number two times in a row.

      Jim W (Moderator) answered


        Question stats

        • Active
        • Views2899 times
        • Answers2 answers
        • Followers0 followers