|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
UDF rand()
i have no idea how that rand() function in the ib_udf works but the values it returns are increasing with ~20 no matter how much i wait between two calls. (now it gives: 80186, 80219, 80240, ...)
and if i have this in a WHILE...DO loop it often returns the same value. and i need this to generate a number in a column which has a unique constraint on it. how can i make it be a REAL random function? |
|
#2
|
|||
|
|||
|
I do not know how well the UDF rand() works; but I do not believe that any random number generator delivers a guaranteed series of unique numbers as you require. By definition, it should not.
Your code will have to handle duplicates gracefully. With respect to the UDF itself, if it is indeed suspect, you could always write your own UDF. Clive |
|
#3
|
||||
|
||||
|
You might want to try uuidUDF
__________________
My blog Tutorials about OSS databases, DBMonster ... Contribute to OSS Development, fill bug reports! Developer Shed eSupport Commented my.ini/my.cnf (ADD YOUR OWN CONFIG TRICK) An introduction to database normalization Natural or Surrogate key Custom ordering for your results Correlated and uncorrelated subqueries Don't turn your outer joins into inner joins Random data (with a bias) |
![]() |
| Viewing: Dev Shed Forums > Databases > Firebird SQL Development > UDF rand() |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|