Announcement

Collapse
No announcement yet.

C++ variable issue

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    C++ variable issue

    Hello Guys,

    Firstly, I am very newbie in C++.

    I am writing some code like below in my cpp file:
    Code:
    	float xPosition;
    	float yPosition;
    
    	xPosition = FMath::RandRange(6, 14) ;
    	yPosition = FMath::RandRange(6, 14) ;

    xPosition variable always taking a number between 6 and 14 but yPosition variable value isnt change. it is always: 0

    What is my mistake?

    Can someone help me?

    Thanks in advance

    #2
    You should be using FMath::FRandRange for floats, that might be the start of problem. RandRange returns integers

    Comment


      #3
      Hi TheJamsh,

      I found my mistake and thank you for your reply. Your answer resolved my problem which wouldn't have yet.

      Comment

      Working...
      X