Let me start the post with a Dilbert cartoon on Random number generator :)
Ok, so we have Rand() function in Cognos TM1 to generate random numbers,
Once a TM1 server is ready then you can get up to 65,536 unique random numbers. After that it is no longer random, it is predictable (with 100% accuracy). Besides, this number is on the server basis (not user basis)
Now let's modify the code slightly to prove the point.
The random numbers generated between the 2 users are exactly the same i.e., the unique times IBM Cognos TM1 can generate random numbers is 65,536 and it is system wide (irrespective of users). If the TM1 service associated with the server is restarted, then the slate is wiped clean.
Ok, so we have Rand() function in Cognos TM1 to generate random numbers,
- Which can be used in Rules as well as in Turbo Integrator (TI)
- Which is uniformly distributed between 0 and 1
- That generates a decimal with 9 digit precision (theoretically up to a billion combination of numbers)
- Whose seed is generated at the start of TM1 server
It will generate 2 files where ini = 1; iMax = 65536; WHILE ( i <= iMax *2 );
IF (i <= iMax);
vFile = 'sk1.txt';
ELSE;
vFile = 'sk2.txt';
ENDIF;
vFile = GetProcessErrorFileDirectory | vFile ;
AsciiOutput (vFile, NumberToString (Rand()) );
i = i + 1; END;
- sk1.txt captures 1st to 65,536 Rand() calls
- sk2.txt captures 65,537 onwards all the way to 131,072 Rand() calls
Once a TM1 server is ready then you can get up to 65,536 unique random numbers. After that it is no longer random, it is predictable (with 100% accuracy). Besides, this number is on the server basis (not user basis)
Now let's modify the code slightly to prove the point.
vFile = 'sk3.txt';Run this process. It will now create sk3.txt. Log out from architect and log back in with a different user. Modify the file name to sk4.txt, save and run the process
vFile = GetProcessErrorFileDirectory | vFile ;
AsciiOutput (vFile, 'Code run by: ' | TM1User () );
i = 1;
iMax = 65536;
WHILE ( i <= iMax);
AsciiOutput (vFile, NumberToString (Rand()) );
i = i + 1;
END;
vFile = 'sk4.txt';Let's compare sk3.txt with sk4.txt
The random numbers generated between the 2 users are exactly the same i.e., the unique times IBM Cognos TM1 can generate random numbers is 65,536 and it is system wide (irrespective of users). If the TM1 service associated with the server is restarted, then the slate is wiped clean.
No comments:
Post a Comment