# How to randomly select a float input?

**URL:** <https://forums.unrealengine.com/t/how-to-randomly-select-a-float-input/1871144>\
**Category:** Blueprint\
**Tags:** random, unreal-engine, Blueprint, question\
**Created:** [May 24, 2024, 4:34pm UTC](https://forums.unrealengine.com/t/how-to-randomly-select-a-float-input/1871144 "2024-05-24T16:34:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fykkus](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fykkus/32/549319_2.png) [@Fykkus](https://forums.unrealengine.com/u/Fykkus)\
**Post date:** [May 24, 2024, 4:34pm UTC](https://forums.unrealengine.com/t/how-to-randomly-select-a-float-input/1871144/1 "2024-05-24T16:34:43Z")

</div>

Hey there! I’ve recently tried to implement bullet spread/bloom.  
I wanted to do it smoothly, so that overtime, the longer you aim, the more accurate the bullet is gonna hit. I did the first step by creating a timeline, that smoothly transitions from the max spread value all the way to zero. Then I didn’t want it to shoot in only one direction. So I was thinking about randomly selecting an input, where the value should be added. But I for the life of me cannot figure it out. I tried different multigate options, different array nodes and such. But it is not really working.

How do you randomly select a FLOAT output you want to use?

Thanks for any answers.

 ![Ideally without exec pins, just with the float pins](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/2/9/22910ea2c8ffb93cc9ad075e101ed4edadec3699.png)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [May 24, 2024, 4:54pm UTC](https://forums.unrealengine.com/t/how-to-randomly-select-a-float-input/1871144/2 "2024-05-24T16:54:41Z")

</div>

Not sure how you want it to work _exactly_, but you could try experimenting with:

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/1/b/61b954caf041bc7f101b77d0abd5b982f144d37c.png)

We start at factor 2 👆 and it goes down to 1 after 1s. The TL’s output could generate a value whose range is ever decreasing:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/e/6/fe629c51856a9d43defc2c0f6152e690afc573be.png)

When we start firing the range is -20 \<\> 20, after 1s the random range would be -10\<\>10. You will need to massage the values and the curve to suit your needs, ofc.

There might be better ways, the 1st thing that came to mind.

* * *

A _maybe_ tip - TLs can dynamically load external curves - that’s one way to make each gun (that holds such curves) have different bloom while still using 1 TL for all guns. May be irrelevant, though.

---

<div class="post-metadata">

**Author:** ![Fykkus](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fykkus/32/549319_2.png) [@Fykkus](https://forums.unrealengine.com/u/Fykkus)\
**Post date:** [May 24, 2024, 4:59pm UTC](https://forums.unrealengine.com/t/how-to-randomly-select-a-float-input/1871144/3 "2024-05-24T16:59:03Z")

</div>

Yeah, sorry, I do not think we understood each other. The timeline works as it is. I meant, that I want to sometimes set the value from the timeline for pin A. Sometimes for pin B and so on. I need a way to **randomly select the float input.**  
But thank you nonetheless, because this will be helpful for future mechanics 🙂 .

---

<div class="post-metadata">

**Author:** ![Fykkus](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fykkus/32/549319_2.png) [@Fykkus](https://forums.unrealengine.com/u/Fykkus)\
**Post date:** [May 24, 2024, 8:13pm UTC](https://forums.unrealengine.com/t/how-to-randomly-select-a-float-input/1871144/4 "2024-05-24T20:13:33Z")

</div>

Nevermind. I figured it out, instead of setting the timeline value as the offset I use that + a random float, so thanks again, because I wouldn’t even have thought about using a random float there.

---

<div class="post-metadata">

**Author:** ![Rev0verDrive](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rev0verdrive/32/907214_2.png) [@Rev0verDrive](https://forums.unrealengine.com/u/Rev0verDrive)\
**Post date:** [May 24, 2024, 8:26pm UTC](https://forums.unrealengine.com/t/how-to-randomly-select-a-float-input/1871144/5 "2024-05-24T20:26:03Z")

</div>

I’d set a min spread float. Then using the TL alpha to multiply the spread based on how long you hold to steady. So long holds get lower spread/deviation.

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [August 4, 2024, 3:47pm UTC](https://forums.unrealengine.com/t/how-to-randomly-select-a-float-input/1871144/6 "2024-08-04T15:47:59Z")

</div>

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