# Random problem with Random Int?

**URL:** <https://forums.unrealengine.com/t/random-problem-with-random-int/413084>\
**Category:** Blueprint\
**Tags:** randomize-array, random-numbers, unreal-engine, UE4, question, Blueprint\
**Created:** [December 25, 2017, 7:01am UTC](https://forums.unrealengine.com/t/random-problem-with-random-int/413084 "2017-12-25T07:01:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheNomadNamedY](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TheNomadNamedY](https://forums.unrealengine.com/u/TheNomadNamedY)\
**Post date:** [December 25, 2017, 7:01am UTC](https://forums.unrealengine.com/t/random-problem-with-random-int/413084/1 "2017-12-25T07:01:46Z")

</div>

Okay so i have this rpg i’m making in which i have all the stats for each of the 12 playable characters saved as struts. these struts are in an array. On level up, it’s suppose to check the array for the leveled up character, take those stats, add stats from a range or 0 to their max possible stat up (different for each character) then put that back into the strut. this works fine (i think) it takes the stats and adds a random number then spits back out an increased number. the problem is that, when used in repetition, the new starting int is different from the last int. I have no clue as to why it starts again at random. the odder part about all this is that for the first 5 or so, IT WORKS. then it just decides to start fumbling around.

 ![224994-12.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/c/c/7cc0166acd46e540004643036f2a1bff24b2afa4.jpeg)

---

<div class="post-metadata">

**Author:** ![Vizgin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Vizgin](https://forums.unrealengine.com/u/Vizgin)\
**Post date:** [December 25, 2017, 8:18am UTC](https://forums.unrealengine.com/t/random-problem-with-random-int/413084/2 "2017-12-25T08:18:28Z")

</div>

I didn’t quite understand what your problem is here. For each of your characters, do you want all of his stats to go up by the **same** amount (where that amount is generated by random)?

---

<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:** [December 25, 2017, 11:53am UTC](https://forums.unrealengine.com/t/random-problem-with-random-int/413084/3 "2017-12-25T11:53:51Z")

</div>

Do note that the following is very likely to generate 2 different values as the _Random_ node produces a result every time the execution chain triggers.

![224998-capture.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/2/7/c27a6958d1d1400121bc71a0dbd52c209dcae2a9.png)

Perhaps it’s a matter of storing the result of the random:

 ![224999-cap2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/c/4/ec4279f2cb625586fbdd5e135333fd6fc2d84b6e.png)

---

<div class="post-metadata">

**Author:** ![TheNomadNamedY](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TheNomadNamedY](https://forums.unrealengine.com/u/TheNomadNamedY)\
**Post date:** [December 25, 2017, 7:41pm UTC](https://forums.unrealengine.com/t/random-problem-with-random-int/413084/4 "2017-12-25T19:41:20Z")

</div>

my problem here is that the next time the character levels up, their stats are diffrent than what they had from the last level up.for example, if they leveled up and had a total of 110 magic attack after the generation. the next level up will add onto a 109 magic attack not the 110 that they had

---

<div class="post-metadata">

**Author:** ![TheNomadNamedY](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TheNomadNamedY](https://forums.unrealengine.com/u/TheNomadNamedY)\
**Post date:** [December 25, 2017, 7:42pm UTC](https://forums.unrealengine.com/t/random-problem-with-random-int/413084/5 "2017-12-25T19:42:00Z")

</div>

there’s a second photo that shows this in action.

---

<div class="post-metadata">

**Author:** ![TheNomadNamedY](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TheNomadNamedY](https://forums.unrealengine.com/u/TheNomadNamedY)\
**Post date:** [December 25, 2017, 7:48pm UTC](https://forums.unrealengine.com/t/random-problem-with-random-int/413084/6 "2017-12-25T19:48:41Z")

</div>

okay i checked again. you were right Everynone, it was just the debugging that was messing me up. it was working correctly :3
