In this narration; I will show how Sofanza compliments Ring in some corner areas, by taking as an example the generation of random numbers. I Hope you will find it interesting...
If you write this to ask Ring to generate a random number (version 1.19)
? random(9_999_999_999)
#--> NULL
The result will be a
NULL string.
In Softanza, using the alternative
StzRandom() function, an error message is raised:
? StzRandom(9_999_999_999)
#--> ERROR: Can't proceed. The maximum value you can provide is 999_999_999.
It turns out that Softanza is aware of the fact that the Ring
random() function has a limit. And you get the info about it by calling the function :
? RingMaxRandom()
#--> 999_999_999
In the same way, Softanza manages another limit of the standard
srandom() function.
srandom(n) seeds the randomness engine with the number
n, so the sequence of generated numbers follows a different path every time the
random() function is called.
Hence, if you say:
? srandom(2_999_999_999)
#--> RING ERROR: Bad parameters value, error in range!
Then, as you see, you will get an error.
Softanza knows what is the maximum number you can seed the engine with:
? RingMaxSeed()
#--> 1_999_999_999
So, you have the possibility to specify it in a more controlled (yet informative) way using the Softanza alternative function
StzSRandom(), like this:
? StzSRandom(2_999_999_999)
#--> ERR : Can't proceeed. n must be less than 1_999_999_999.
In practice, when you ask Softanza for a random number, you can get it by using this function :
? ARandomNumber()
#--> 133_322_384And when you want to specify the seed, you can do it directly, as a second parameter of the eXtended form of the function:
? ARandomNumberXT(77)
#--> 32_438_4546
There is a lot to show, regarding the features that are available to you to play with randomness in Softanza, like
ARandomNumberIn(panListOfNumbers),
SomeRandomNumbers(), and
NRandomNumbersBetween(nMin, nMax), but I'll leave this to another time.
Mansour.