|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
RAND() function in MB, to generate a unique transctionID |
« View previous topic :: View next topic » |
Author |
Message
|
rahdilarum |
Posted: Wed Jan 04, 2006 9:24 am Post subject: RAND() function in MB, to generate a unique transctionID |
|
|
Novice
Joined: 02 Mar 2002 Posts: 15 Location: Winston-Salem, NC
|
From: Kanjarla, Vamshidhar Sent: Wed 1/4/2006 11:11 AM
To: Tjokroamidjojo, Widianto; Behara, Murali
Cc: Eksioglu, Oguz
Subject: RAND() function in MB:
Attachments:
View As Web Page
Hi,
We are using the RAND() function in MB, to generate the transctionID or BPID.
The concern is the precision and max length of the random float value returned by this function.
In the code right now, we are not giving any parameters for the RAND() function.
As from the documentation in Infocenter, it says the follwoing:
The RAND function returns a pseudo random number in the range 0.0 to 1.0. If supplied, the parameter initializes the pseudo random sequence.
The parameter can be of any numeric data type, but any fractional part is ignored. The result is FLOAT unless the parameter is NULL, in which case the result is NULL.
Any confirmation on this issue is highly appreciated.
Thanks,
Vamshi. |
|
Back to top |
|
 |
rahdilarum |
Posted: Wed Jan 04, 2006 9:26 am Post subject: RAND() function in MB, to generate unique TransactionId |
|
|
Novice
Joined: 02 Mar 2002 Posts: 15 Location: Winston-Salem, NC
|
From: Behara, Murali Sent: Wed 1/4/2006 12:20 PM
To: Kanjarla, Vamshidhar
Cc: Tjokroamidjojo, Widianto; Eksioglu, Oguz; Tonangi, Suresh;
Subject: RE: RAND() function in MB:
Attachments:
View As Web Page
Vamsi,
The message broker uses the underlying scalar function of the database.
You are right it returns a random value between 0 & 1.
To get a different random number donot specify the seed value
Eg. if you don't specify the seed value you will get random values like
+1.25125888851588E-003
+9.67131565294351E-002
+4.95803704947050E-001
+8.80550553910947E-001
if you specify a seed value say rand(21) the result for instance for 4 executions would be same
+3.26548051393170E-003
+3.26548051393170E-003
+3.26548051393170E-003
+3.26548051393170E-003
|
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Jan 04, 2006 9:43 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
If you want a unique ID, just use UUIDASBLOB or UUIDASCHAR, don't mess around with RAND. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|