Hi Folks - I hope you can help. I am writing a chemistry program and have to generate random numbers between 0 and 100 with 3 decimal places. I tried using the RRandom command in the Expression Editor, but I only get whole numbers.
I solved the problem, but want to know if there is an easier solution.
Here is my solution...
I created 3 counters called IntPart, DecPart, TotalNum
I created 3 strings called IntString, decString, TotalString
Using the Random command I create the IntPart value between 0 and 100 and then I create the DecPart value between 0 and 1000.
Then using the Str$ command, I convert each counter to a string (setting the Alterable Strings).
Then I combine the IntString and the DecString with a decimal inbetween to produce a the TotalString.
Finally, I convert the TotalString to a number with the Val command in the TotalNum counter .
Is there a more direct way to get these random numbers?
Thanks for your time.
- Rich
A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.
Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!
Clickteam.
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!