× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Jon,

A double-precision floating point number can only store up to 15 or so digits of precision. Therefore, if you try to use it to generate a 60-digit random number, it's not going to cover every possible value. There will be ranges of numbers that aren't possible to reach.

Considering that the OP is asking for a string of up to 99 digits, this seems like an important point to make.


Jon Paris wrote:
On 8-Dec-08, at 11:00 AM, midrange-l-request@xxxxxxxxxxxx wrote:

but I wanted to build in the ability to generate random numbers of other lengths also

Don't forget that the leading zeros of any number you generate are significant when you combine two numbers into one. I am no mathematician, but I suspect that munging two five digit numbers into one 10 digit number is probably not statistically valid but ... The important bit is that chopping of the leading zeros as you were doing by using %Char is not goodness. You should use %EditC with the 'X' edit code - that will retain the leading zeros.

And using CEERAN0 will give you a _way_ easier way of generating an arbitrary length number (at least up to the system capacity of 60 odd digits) since it gives you back a floating point value between 0 and 1 and you simply multiply that by the largest number you want. Way simpler.

Jon Paris

www.Partner400.com
www.SystemiDeveloper.com




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.