Jump to content
UBot Underground

How to stop ubot from Rounding up?


Recommended Posts

I want a randomly generated number in decimal.

 

When I try this: 

ui button("Click me for a random number") {
    set(#output, $rand(1.0, 9.9), "Local")
}

 

I always get back a whole number, not a decimal.

 

Is there anyway to have it not round up? 

Link to post
Share on other sites

Exactly! I have actually never seen a rand generator that deals with floating numbers, only integers. Divide with whatever you want it to be.

Link to post
Share on other sites

Dividing works. Thanks jomark3!

 

For anyone interested, here's the working code:

 

ui button("Click me for a random number") {
    set(#output, $rand(10, 99), "Local")
    set(#output2, $divide(#output, 10), "Local")
}
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...