# How to change random time in Set Timer Delegate every loop?

**URL:** <https://forums.unrealengine.com/t/how-to-change-random-time-in-set-timer-delegate-every-loop/304334>\
**Category:** Audio\
**Tags:** random, timer, unreal-engine, looping, delegate, loop, question\
**Created:** [January 18, 2015, 11:54pm UTC](https://forums.unrealengine.com/t/how-to-change-random-time-in-set-timer-delegate-every-loop/304334 "2015-01-18T23:54:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![darkpivot](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@darkpivot](https://forums.unrealengine.com/u/darkpivot)\
**Post date:** [January 18, 2015, 11:54pm UTC](https://forums.unrealengine.com/t/how-to-change-random-time-in-set-timer-delegate-every-loop/304334/1 "2015-01-18T23:54:06Z")

</div>

I have a ‘set timer delegate’ node, set to looping. I have the time set to a ‘random float in range’ with a min and max time value. I want it so that every time the timer loops, it will randomize the time again. My problem is that on the initial execution of the timer, it will pick a random value, but each time it loops it will use the same value without randomizing again. How can I get it to randomize each time it executes a loop?

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [January 19, 2015, 12:21am UTC](https://forums.unrealengine.com/t/how-to-change-random-time-in-set-timer-delegate-every-loop/304334/2 "2015-01-19T00:21:08Z")

</div>

Instead of setting “Looping” to true, plug random number generation to “Time” input and at timer trigger call “set timer delegate” again, it will set timer over and overagain increasing a loop but with different “Time” every time. Don’t worry, set timer functions are async so you won’t infinitely loop the thread. Ofcorse then to stop this timer to loop you will need to break loop you made with nodes by condition check before each set timer call

---

<div class="post-metadata">

**Author:** ![darkpivot](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@darkpivot](https://forums.unrealengine.com/u/darkpivot)\
**Post date:** [January 19, 2015, 1:30am UTC](https://forums.unrealengine.com/t/how-to-change-random-time-in-set-timer-delegate-every-loop/304334/3 "2015-01-19T01:30:33Z")

</div>

thanks! i got it.

---

<div class="post-metadata">

**Author:** ![lennysunreal](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/lennysunreal/32/984341_2.png) [@lennysunreal](https://forums.unrealengine.com/u/lennysunreal)\
**Post date:** [December 22, 2016, 11:47pm UTC](https://forums.unrealengine.com/t/how-to-change-random-time-in-set-timer-delegate-every-loop/304334/4 "2016-12-22T23:47:32Z")

</div>

Thank you so very much :D.  
Would be awesome if there was a change Timer Time node. BUT! this totaly worked for me too so ty tyty

---

<div class="post-metadata">

**Author:** ![S0RC](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@S0RC](https://forums.unrealengine.com/u/S0RC)\
**Post date:** [July 19, 2022, 12:52pm UTC](https://forums.unrealengine.com/t/how-to-change-random-time-in-set-timer-delegate-every-loop/304334/5 "2022-07-19T12:52:46Z")

</div>

I bumped into this same problem using a random start timer on AActor BeginPlay. I found this excellent tutorial blog explaining how this can work in C++.

[Unreal Engine C++ Fundamentals – FTimerHandle & Timers](http://jollymonsterstudio.com/2019/02/19/unreal-engine-c-fundamentals-ftimerhandle-timers/)

---

<div class="post-metadata">

**Author:** ![PAPACOUBS](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PAPACOUBS](https://forums.unrealengine.com/u/PAPACOUBS)\
**Post date:** [May 4, 2024, 1:39pm UTC](https://forums.unrealengine.com/t/how-to-change-random-time-in-set-timer-delegate-every-loop/304334/6 "2024-05-04T13:39:31Z")

</div>

Hi everyone, found another solution to this:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/8/a/08af7f40aded3a9451c51fb8b49008378edc18db.png)  
I set looping to true with a 1 second timer, get a reference to the timer handle, and then pause that timer handle after execution of whatever you’re trying to do. Once you pause the timer handle I set a delay node with a random float in range node (1-5 seconds, keeping in mind this really means 2-6 seconds because of the one second loop), and then unpause the timer to continue the loop. Hope this helps!
