Subject | Re: [firebird-support] Rand function in ib_udf |
---|---|
Author | Frank Schlottmann-Goedde |
Post date | 2004-06-25T17:19:43Z |
Walter Ogston wrote:
http://firebird.sourceforge.net/download/snapshot_builds/win/fb20.zip
It contains:
/*****************************************
*
* s r a n d
*
*****************************************
*
* Functional description:
* Returns a random number between 0
* and 1. Note the random number
* generator is seeded using the current
* time.
*
*****************************************/
DECLARE EXTERNAL FUNCTION srand
RETURNS DOUBLE PRECISION BY VALUE
ENTRY_POINT 'IB_UDF_srand' MODULE_NAME 'ib_udf';
/*****************************************
*
* r a n d
*
*****************************************
*
* Functional description:
* Returns a random number between 0
* and 1. Note: Use srand to seed the
* random number generator.
* This behavior has been changed.
*****************************************/
DECLARE EXTERNAL FUNCTION rand
RETURNS DOUBLE PRECISION BY VALUE
ENTRY_POINT 'IB_UDF_rand' MODULE_NAME 'ib_udf';
You could replace your version of ib_udf.dll with the version from the
zip-file.
You will have to declare srand to your database and use this once to
seed the generator.
No more changes needed.
hth
Frank
--
"Fascinating creatures, phoenixes, they can carry immensely heavy loads,
their tears have healing powers and they make highly faithful pets."
- J.K. Rowling
> Ivan,There should be a working version in the actual snapshot build:
> 2. Copy the .dll file into the udf folder along with fbudf.dll and ib_udf.dll
>
> 3. Drop old declaration of rand in database, and re-define referring to
> the new dll. It looks to me that Firebird already knows the path to the
> udf folder, but I don't see where this is set. Is it a hard-coded default?
>
> 4. Once it is working, send the code to someone for possible inclusion in
> the next release.
>
> Any comments, traps, suggestions?
http://firebird.sourceforge.net/download/snapshot_builds/win/fb20.zip
It contains:
/*****************************************
*
* s r a n d
*
*****************************************
*
* Functional description:
* Returns a random number between 0
* and 1. Note the random number
* generator is seeded using the current
* time.
*
*****************************************/
DECLARE EXTERNAL FUNCTION srand
RETURNS DOUBLE PRECISION BY VALUE
ENTRY_POINT 'IB_UDF_srand' MODULE_NAME 'ib_udf';
/*****************************************
*
* r a n d
*
*****************************************
*
* Functional description:
* Returns a random number between 0
* and 1. Note: Use srand to seed the
* random number generator.
* This behavior has been changed.
*****************************************/
DECLARE EXTERNAL FUNCTION rand
RETURNS DOUBLE PRECISION BY VALUE
ENTRY_POINT 'IB_UDF_rand' MODULE_NAME 'ib_udf';
You could replace your version of ib_udf.dll with the version from the
zip-file.
You will have to declare srand to your database and use this once to
seed the generator.
No more changes needed.
hth
Frank
--
"Fascinating creatures, phoenixes, they can carry immensely heavy loads,
their tears have healing powers and they make highly faithful pets."
- J.K. Rowling