Author: steve-myers
Posted: Fri Sep 02, 2016 1:07 pm (GMT 5.5)
Not necessarily. RANDOM returns a floating point value between 0 and 1. It is not stated in Enterprise COBOL for z/OS V4.2 Language Reference if the number is ânormalized,â or âunnormalized,â or if it returns a 32 bit or 64 bit number. If it returns a 32 bit number, which seems most likely, it has a 1 bit sign, a 7 bit exponent, and a 24 bit value. Don't worry about this ânormalizedâ or âunnormalizedâ business â that's just computer number geek talk, though the difference might affect scaling the number to the character set. What's important is 24 bits, which means 2^24 unique values. This is a large number, but it is much less than the 2 billion Mr. Sample innocently talked about.
The next issue is the character set. Lower case, upper case, numbers, and ânational charactersâ is a fairly large set, but I think some characters should be excluded: 0 and 1 (the numbers), O (the upper case letter), o (the lower case character), I (the upper case character), and l (the lower case character) are my suggestions. It is all too easy to misread 0 and O, and l and 1. Heck, 55 years ago I learned to type on a typewriter where the typist was expected to use l, not 1!
Posted: Fri Sep 02, 2016 1:07 pm (GMT 5.5)
Robert Sample wrote: |
... you get over 2 billion values before they start repeating. ... |
The next issue is the character set. Lower case, upper case, numbers, and ânational charactersâ is a fairly large set, but I think some characters should be excluded: 0 and 1 (the numbers), O (the upper case letter), o (the lower case character), I (the upper case character), and l (the lower case character) are my suggestions. It is all too easy to misread 0 and O, and l and 1. Heck, 55 years ago I learned to type on a typewriter where the typist was expected to use l, not 1!