To generate a Globally Unique Identifier, use the *GUID system variable.
*GUID uses a Mersenne twister Pseudorandom number generator (PRNG) as a GUID. It has no dependency on any machine state – for example, it is not dependent on the MAC address or current time. It is also thread safe. The same algorithm is used on Windows, IBM i and Linux.
The Mersenne twister PRNG provides fast generation of very high-quality pseudorandom integers; it was designed specifically to rectify many of the flaws found in older PRNGs. Its name derives from the fact that its period length is chosen to be a Mersenne prime. LANSA implements MT19937. See this link for more information: Mersenne_twister. Note: If sufficient numbers are observed (624) it is possible to predict all future iterations, so it is not suitable for cryptographic purposes.
*GUID is expected to be generated once when inserting a row and then not to be updated again. A standard field, #STD_GUID, has been provided to implement this behaviour. This field has a Trigger. Before Insert it assigns *GUID to the field. Before Update it ensures the field has not changed, and if it has changed it ABORTs as it is a programming level error, not a user error.