How do I Randomly Select a Text

  • Hey guys , I want a text to be set at a random number between 1 and 3 , and this is what I tried to do

    . But it doesn't work , can someone tell how to do this? Btw this is for selecting a random character , the text is just an example.

    EDIT: can't upload an attachment , the upload option doesn't appear.

  • instead of random(1,3) you could use choose(1,2,3)

    random(1,3) can also produce 1.5, 1.7, 2.3, etcetera as an answer, so the chance of it being exactly 1 or 2 or 3 is pretty small..

    other options would be to use round(random()), floor(random()) ceil(random() or int(random())

    from the manual:

    random(x)

    Generate a random float from 0 to x, not including x. E.g. random(4) can generate 0, 2.5, 3.29293, but not 4. Use floor(random(4)) to generate just the whole numbers 0, 1, 2, 3.

    random(a, b)

    Generate a random float between a and b, including a but not including b.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thank you so much mate!!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)