# Randomizing Scale of Sprite - \*Problem\*

**URL:** <https://forum.code.org/t/randomizing-scale-of-sprite-problem/33565>\
**Category:** CS Discoveries\
**Tags:** csd-unit-3\
**Created:** [October 20, 2020, 3:47pm UTC](https://forum.code.org/t/randomizing-scale-of-sprite-problem/33565 "2020-10-20T15:47:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sheri.mcnair](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@sheri.mcnair](https://forum.code.org/u/sheri.mcnair)\
**Post date:** [October 20, 2020, 3:47pm UTC](https://forum.code.org/t/randomizing-scale-of-sprite-problem/33565/1 "2020-10-20T15:47:07Z")

</div>

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.

> **[Check out what I made](https://studio.code.org/projects/gamelab/hp8dDkUdpg3uX7qovNEdYYYwENEjax-64AlXwr-r9Nc)**
>
> I wrote the code myself with Code.org

  
~Sheri

---

<div class="post-metadata">

**Author:** ![mkmietowicz](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/mkmietowicz/32/6322_2.png) [@mkmietowicz](https://forum.code.org/u/mkmietowicz)\
**Post date:** [October 21, 2020, 2:52pm UTC](https://forum.code.org/t/randomizing-scale-of-sprite-problem/33565/2 "2020-10-21T14:52:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sheri.mcnair](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@sheri.mcnair](https://forum.code.org/u/sheri.mcnair)\
**Post date:** [October 22, 2020, 3:21pm UTC](https://forum.code.org/t/randomizing-scale-of-sprite-problem/33565/4 "2020-10-22T15:21:41Z")

</div>

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