Luke 18 Posted April 18, 2013 Report Share Posted April 18, 2013 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? Quote Link to post Share on other sites
jomark3 25 Posted April 18, 2013 Report Share Posted April 18, 2013 Why not randomize from 10 - 99 then divide by 10 Quote Link to post Share on other sites
Anonym 53 Posted April 18, 2013 Report Share Posted April 18, 2013 Exactly! I have actually never seen a rand generator that deals with floating numbers, only integers. Divide with whatever you want it to be. Quote Link to post Share on other sites
Luke 18 Posted April 18, 2013 Author Report Share Posted April 18, 2013 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") } Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.