Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / random number float

Author
Message
metamorpho
8
Years of Service
User Offline
Joined: 17th Oct 2016
Location: Planet Earth
Posted: 21st Apr 2019 15:24 Edited at: 21st Apr 2019 16:00
how do i get a random number like float?

why in this code the team random gives only integers?


ter as float =0
do
if GetRawKeyPressed(32)
ter =random (1,100)
endif
print (ter)
Sync()
loop
end
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
metamorpho
8
Years of Service
User Offline
Joined: 17th Oct 2016
Location: Planet Earth
Posted: 21st Apr 2019 16:16
Scraggle, thank !!!!
Golelorn
8
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 21st Apr 2019 17:30
Alternatively, you can do this:

temp = random(1,100)
ter = temp

Something to keep in mind for the future:
Quote: " If all things on the right are integers, then the calculation will use pure integer math."

Login to post a reply

Server time is: 2024-11-22 21:31:27
Your offset time is: 2024-11-22 21:31:27