ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » RAND() function in MB, to generate a unique transctionID

Post new topic  Reply to topic
 RAND() function in MB, to generate a unique transctionID « View previous topic :: View next topic » 
Author Message
rahdilarum
PostPosted: Wed Jan 04, 2006 9:24 am    Post subject: RAND() function in MB, to generate a unique transctionID Reply with quote

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
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
rahdilarum
PostPosted: Wed Jan 04, 2006 9:26 am    Post subject: RAND() function in MB, to generate unique TransactionId Reply with quote

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
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
jefflowrey
PostPosted: Wed Jan 04, 2006 9:43 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » RAND() function in MB, to generate a unique transctionID
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.