How do I Randomly Select a Text

Get help using Construct 2

Post » Sat Apr 25, 2015 12:05 pm

Hey guys , I want a text to be set at a random number between 1 and 3 , and this is what I tried to doImage. 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.
Posts: 9
Reputation: 193

Post » Sat Apr 25, 2015 12:51 pm

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:

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.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
Posts: 6,160
Reputation: 19,775

Post » Sat Apr 25, 2015 2:02 pm

Thank you so much mate!!
Posts: 9
Reputation: 193

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests