Randomizing Scale of Sprite - *Problem*

Hi there,
My question is this: Why does randomizing the scale size of the “text” sprite only work with whole numbers and not decimals? When using decimals, the text will do no growing/shrinking… Why does the image disappear with anything set less than 1? The student wants to have the text random sizes while the program is run. Thank you for any help.


~Sheri

Hi @sheri.mcnair,

The “randomNumber” block generates a random integer. If you want it to scale to a decimal value, you may wish to generate a random number integer and then divide by 10 to make it into a decimal.

For example, to get a tenths-value decimal, I’d generate a random number between 0 and 10, and then divide that number by 10.

In line 21, the code is trying to generate a random integer that exists between 1 and 2, not inclusive of 1 and 2. Such a number doesn’t exist. I tried something like what I described above & it seemed to work.

Can you try it out & report back if you need more assistance?

–Michael K.

3 Likes

That did the trick. Thank you so much! I so appreciate your help.

1 Like