# Slow/duplicate random number generation

**URL:** <https://community.thunkable.com/t/slow-duplicate-random-number-generation/387410>\
**Category:** Questions about Thunkable X\
**Created:** [December 31, 2019, 5:40pm UTC](https://community.thunkable.com/t/slow-duplicate-random-number-generation/387410 "2019-12-31T17:40:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [December 31, 2019, 5:40pm UTC](https://community.thunkable.com/t/slow-duplicate-random-number-generation/387410/1 "2019-12-31T17:40:24Z")

</div>

If I generate a random number when a screen starts, it seems to generate one number first and then immediately generate a second number.

You can see this in the simple project I created:

[https://x.thunkable.com/copy/df3abda9fbdaf98d41ab32f29d98216c](https://x.thunkable.com/copy/df3abda9fbdaf98d41ab32f29d98216c)

If you tap the button, you don’t see the effect but if you start the screen, it slowly generates two numbers instead of one.

In the video, I open Thunkable Live with 90 showing. As the screen “starts,” it generates a random number but displays 49 and then 80. I then tap the button to generate the next random number and it displays 71.

---

<div class="post-metadata">

**Author:** ![domhnallohanlon](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/domhnallohanlon/32/29554_2.png) [@domhnallohanlon](https://community.thunkable.com/u/domhnallohanlon)\
**Post date:** [July 15, 2020, 12:52pm UTC](https://community.thunkable.com/t/slow-duplicate-random-number-generation/387410/2 "2020-07-15T12:52:36Z")

</div>

Was this just an issue with live testing @tatiang?

I wonder if you had duplicate event handlers here somewhere?

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [July 20, 2020, 6:37pm UTC](https://community.thunkable.com/t/slow-duplicate-random-number-generation/387410/3 "2020-07-20T18:37:43Z")

</div>

@domhnallohanlon This is the project:

[https://x.thunkable.com/copy/19d05ae99db9211352a048d05402fd2d](https://x.thunkable.com/copy/19d05ae99db9211352a048d05402fd2d)

It doesn’t seem to be doing the duplicate number generation any more. I changed the display so it adds the next number onto the label’s text string.

---

<div class="post-metadata">

**Author:** ![domhnallohanlon](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/domhnallohanlon/32/29554_2.png) [@domhnallohanlon](https://community.thunkable.com/u/domhnallohanlon)\
**Post date:** [July 25, 2020, 12:53pm UTC](https://community.thunkable.com/t/slow-duplicate-random-number-generation/387410/4 "2020-07-25T12:53:16Z")

</div>

Thanks @tatiang, Just looking at your example now, it’s behaving differently to the example in your video. I’m seeing a strong of random numbers, and a new number is added to the end each time the button is pressed.

Is everything working ok for you now?

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [July 28, 2020, 7:19am UTC](https://community.thunkable.com/t/slow-duplicate-random-number-generation/387410/5 "2020-07-28T07:19:52Z")

</div>

Yes, it seems to be working fine. Thanks.

---

<div class="post-metadata">

**Author:** ![luv.ak.tech](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/luv.ak.tech/32/104896_2.png) [@luv.ak.tech](https://community.thunkable.com/u/luv.ak.tech)\
**Post date:** [November 5, 2020, 3:38am UTC](https://community.thunkable.com/t/slow-duplicate-random-number-generation/387410/6 "2020-11-05T03:38:28Z")

</div>

yes it is an error i think just try canvas in this if you want

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 11:46am UTC](https://community.thunkable.com/t/slow-duplicate-random-number-generation/387410/7 "2024-11-08T11:46:13Z")

</div>


