Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A random double?
#1
Looking to do some randomisation on my macro. I learned how to do int random numbers but couldnt find a way to do the same thing with double/ float, with 2 decimal points. Any way of doing this?
Thank you
#2
Function RandomNumber creates double from 0 to 1. If need other range, multiply, and optionally add offset.
Macro Macro166
Code:
Copy      Help
out
double d1(5) d2(10)
rep 30
,out d1+(RandomNumber*(d2-d1))
#3
Great! Just need to limit to 2 decimals and all set Smile
Thank you!
#4
Macro Macro166
Code:
Copy      Help
out
double d1(5) d2(10)
rep 30
,out Round(d1+(RandomNumber*(d2-d1)) 2)
#5
Ha ha i was browsing the forum to find the way to round when your answer poped up Smile I seriocely cant believe how fast you come up with these solutions. Thank's again Gintaras! Smile


Forum Jump:


Users browsing this thread: 1 Guest(s)