# \[Scene Graph\] Using GetRandomInt favors specific ints when used in conjunction with AddEntities

**URL:** <https://forums.unrealengine.com/t/scene-graph-using-getrandomint-favors-specific-ints-when-used-in-conjunction-with-addentities/2656930>\
**Category:** Issues and Bug Reporting\
**Tags:** id, slug, open, name\
**Created:** [September 15, 2025, 8:09pm UTC](https://forums.unrealengine.com/t/scene-graph-using-getrandomint-favors-specific-ints-when-used-in-conjunction-with-addentities/2656930 "2025-09-15T20:09:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![natereese](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/natereese/32/726163_2.png) [@natereese](https://forums.unrealengine.com/u/natereese)\
**Post date:** [September 15, 2025, 8:09pm UTC](https://forums.unrealengine.com/t/scene-graph-using-getrandomint-favors-specific-ints-when-used-in-conjunction-with-addentities/2656930/1 "2025-09-15T20:09:21Z")

</div>

### Summary

We’ve noticed a strange behavior when using GetRandomInt and AddEntities within the same function. The random value returned seems to favor a few numbers. Here’s an example:

```
        RoomDiceRoll := GetRandomInt(0,5)

        if(RoomDiceRoll = 0):
            InitiateSpawnRoom(SpawnTransform, Prefab_Cave03{})
        else if(RoomDiceRoll = 1):
            InitiateSpawnRoom(SpawnTransform, Prefab_Cave02{})
        else if(RoomDiceRoll = 2):
            InitiateSpawnRoom(SpawnTransform, Prefab_Cave01{})
        else if(RoomDiceRoll = 3):
            InitiateSpawnRoom(SpawnTransform, Prefab_Cave04{})
        else if(RoomDiceRoll = 4):
            InitiateSpawnRoom(SpawnTransform, Prefab_Cave05{})
        else:
            InitiateSpawnRoom(SpawnTransform, Prefab_Cave06{})

```

This code is used to randomly spawn a new room when a player reaches a checkpoint. However, some rooms never spawn after 30+ dicerolls, while others will generate multiple times in a row. We’ve seen the same results running 30+ tests to confirm the issue. It feels like there may be an issue with how random values are generated from SG components.

This issue will not happen if you are merely generating a new number every X frames. It seems to only happen when accompanied by AddEntities or other more intensive processes.

### Please select what you are reporting on:

Unreal Editor for Fortnite

### What Type of Bug are you experiencing?

Assets

### Steps to Reproduce

Create several room sized prefabs of varying complexity. Within the same function, generate a new Int using GetRandomInt and use it to decide which entitiy to add to the scene similar to the above code.

### Expected Result

We would expect to see a wide range of random results / layouts.

### Observed Result

Certain entries won’t spawn for the first 25+ dicerolls. Other entires will spawn at an above average rate.

### Platform(s)

PC

### Upload an image

 ![GetRandomInt.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/a/d/2ad140a36e075512144844326d7e9064c7b454bb.png)

---

<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:** [March 14, 2026, 8:09pm UTC](https://forums.unrealengine.com/t/scene-graph-using-getrandomint-favors-specific-ints-when-used-in-conjunction-with-addentities/2656930/6 "2026-03-14T20:09:43Z")

</div>

This topic was automatically closed after 180 days. New replies are no longer allowed.

---

<div class="post-metadata">

**Author:** ![Bug-Reporter](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/bug-reporter/32/1223650_2.png) [@Bug-Reporter](https://forums.unrealengine.com/u/Bug-Reporter)\
**Post date:** [July 21, 2026, 4:02pm UTC](https://forums.unrealengine.com/t/scene-graph-using-getrandomint-favors-specific-ints-when-used-in-conjunction-with-addentities/2656930/7 "2026-07-21T16:02:46Z")

</div>

FORT-973392 has been ‘Backlogged’. This is an issue that is in a queue to be addressed.
