DaVIdoSS Posted August 20, 2014 Report Share Posted August 20, 2014 Could someone please show me how this work: _rndnum = round (random 3) + 4; This returns 1+4=5 , 2+4=6, 3+4=7 ?? and that: _rndnum = floor(random 7); This returns 1,2,3,4,5,6 ?? Is that right? I try to search about my self but idk even how i should call it. Link to comment Share on other sites More sharing options...
0 Glenn Posted August 20, 2014 Report Share Posted August 20, 2014 You can find info here: round => https://community.bistudio.com/wiki/round floor => https://community.bistudio.com/wiki/floor like in math, the content in the (parenthesis) is taken separately, so the result of Random is generated, and you either do the rounding or the floor in that give n number. Your first example of the round(random 3) is correct, the result will be that. Link to comment Share on other sites More sharing options...
0 deadeye Posted August 20, 2014 Report Share Posted August 20, 2014 _rndnum = round (random 3) + 4; could also return 0+4=5 _rndnum = floor(random 7); could return 0,1,2,3,4,5,6 Link to comment Share on other sites More sharing options...
0 caesium137 Posted August 20, 2014 Report Share Posted August 20, 2014 Dunno exactly, but isnt floor(random 3) not like 0,1,2? Link to comment Share on other sites More sharing options...
0 deadeye Posted August 21, 2014 Report Share Posted August 21, 2014 Dunno exactly, but isnt floor(random 3) not like 0,1,2? Yes, because random x returns a floating point number from 0 (inclusive) to x (not inclusive) https://community.bistudio.com/wiki/random (random 3) might return 2.99999 but never 3 Link to comment Share on other sites More sharing options...
Question
DaVIdoSS
Could someone please show me how this work:
This returns 1+4=5 , 2+4=6, 3+4=7 ??
and that:
This returns 1,2,3,4,5,6 ??
Is that right?
I try to search about my self but idk even how i should call it.
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now