# How to Spawn actor in random Y location

**URL:** <https://forums.unrealengine.com/t/how-to-spawn-actor-in-random-y-location/367127>\
**Category:** Blueprint\
**Tags:** actors, spawn-rate, spawning, real-time, unreal-engine, Blueprint, question\
**Created:** [August 14, 2016, 7:40pm UTC](https://forums.unrealengine.com/t/how-to-spawn-actor-in-random-y-location/367127 "2016-08-14T19:40:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![BaseDrop0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BaseDrop0](https://forums.unrealengine.com/u/BaseDrop0)\
**Post date:** [August 14, 2016, 7:40pm UTC](https://forums.unrealengine.com/t/how-to-spawn-actor-in-random-y-location/367127/1 "2016-08-14T19:40:58Z")

</div>

I am trying to spawn an actor from a BP in a random point along the Y axis. Currently trying to get it to spawn in a box I made, but when I try and spawn it the current way, it just spawns in the middle of the box every time.

 ![102836-blueprints.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/c/0/cc07ad13950f321012d5d55b1c677ea8bb63dfc1.png)

(BTW the delay node was just to start spawning 4 seconds into the game but it is irrelevant in this post)

---

<div class="post-metadata">

**Author:** ![TJ\_V](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tj_v/32/1008648_2.png) [@TJ\_V](https://forums.unrealengine.com/u/TJ_V)\
**Post date:** [August 16, 2016, 8:12pm UTC](https://forums.unrealengine.com/t/how-to-spawn-actor-in-random-y-location/367127/2 "2016-08-16T20:12:21Z")

</div>

Hey SuperSalyanBro9,

I just gave this a try and it works for me. Also your Min and Max values are the same, which will cause the actor to always spawn in the same place.

 ![103117-spawnony01.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/6/e/46e33b86fb828e034d974b6f7ece0409a058461a.png)

Let me know if that helps.

Cheers,

TJ

---

<div class="post-metadata">

**Author:** ![Streliteela](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Streliteela](https://forums.unrealengine.com/u/Streliteela)\
**Post date:** [March 4, 2019, 7:47am UTC](https://forums.unrealengine.com/t/how-to-spawn-actor-in-random-y-location/367127/3 "2019-03-04T07:47:28Z")

</div>

I think you should change the value of seed that is used for Rand().  
Plz check the [website](https://www.epicgames.com/unrealtournament/forums/unreal-tournament-development/ut-development-programming/11540-solved-rand-not-seeded-causing-random-numbers-being-the-same-for-every-start)  
Hope it will be helpful.

---

<div class="post-metadata">

**Author:** ![leofucci](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@leofucci](https://forums.unrealengine.com/u/leofucci)\
**Post date:** [March 7, 2019, 3:06am UTC](https://forums.unrealengine.com/t/how-to-spawn-actor-in-random-y-location/367127/4 "2019-03-07T03:06:22Z")

</div>

You have some things to change there:

1. Random float in range, from and to are the same, so it will be always 5.

2. 5 is actually a very small value for a location (it is almost 5 cms I think), try to spawn your actor in editor, then move it +5 in any axis, you probably will note no difference at all. try something bigger, like -500 to 500.

3. Collision handling override, be sure is set to “Always spawn, ignore collision”

4. TransformLocation method I think is used to change from local space to world space, use “PLUS” instead, otherwise will spawn in 0-0-0 of the map.
