# Random Integers not workimg

**URL:** <https://community.thunkable.com/t/random-integers-not-workimg/3734478>\
**Category:** Questions about Thunkable X\
**Created:** [April 12, 2025, 2:18am UTC](https://community.thunkable.com/t/random-integers-not-workimg/3734478 "2025-04-12T02:18:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ruhaan.j140u](https://avatars.discourse-cdn.com/v4/letter/r/f08c70/32.png) [@ruhaan.j140u](https://community.thunkable.com/u/ruhaan.j140u)\
**Post date:** [April 12, 2025, 2:18am UTC](https://community.thunkable.com/t/random-integers-not-workimg/3734478/1 "2025-04-12T02:18:27Z")

</div>

Sorry to bother but my code looks perfectly right. I am trying to make the images random colors using the random integer block, but sometimes the color doesn’t even show up! It could be something else but I thing that the random integer is not generating the right numbers. This is the project. [Thunkable](https://x.thunkable.com/projects/67f9c69b3d7c55db08045012/1b956e8b-caed-4c40-99af-2eb41713af82/blocks) P.S: My code was too long so I had to link the project, sorry 😅

---

<div class="post-metadata">

**Author:** ![krish05](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/krish05/32/200523_2.png) [@krish05](https://community.thunkable.com/u/krish05)\
**Post date:** [April 12, 2025, 1:16pm UTC](https://community.thunkable.com/t/random-integers-not-workimg/3734478/2 "2025-04-12T13:16:39Z")

</div>

The problem is that you have put in the raw block instead of a variable. Each time you call this block in your code, it will call multiple random numbers between 1-4. Set the random integer block in a variable, then replace the random block in your if statements with the variables.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [July 11, 2025, 1:17pm UTC](https://community.thunkable.com/t/random-integers-not-workimg/3734478/3 "2025-07-11T13:17:46Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
