Random Range versus RandHelper

hi
I did Random word selection before the class and used RandHelper which is similar to RandRange but takes only a maximum since the minimum is set to Zero by default… Actually RandRange is even implemented using RandHelper.

There is a difference in RandHelper ; the maximum number passed in is not included therefore there is no need for minus one .

Here is my code ;

 HiddenWord = WordList[FMath::RandHelper(WordList.Num())];
 //HiddenWord = WordList[FMath::RandRange(0, WordList.Num()-1)];
3 Likes

Interesting way to put it. Great job!

1 Like

thank you …i should also mention or show WorldList is a member variable of TArray and the value are loaded from the txt file , i posted all that previously…i also used FStringView in ProcessGuess() and IsIsogram() functions…it requires UE4.25 tough :=)

Privacy & Terms