Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Bases de datos > Firebird e Interbase
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

 
 
Herramientas Buscar en Tema Desplegado
  #5  
Antiguo 15-04-2008
Avatar de DarkDudae
DarkDudae DarkDudae is offline
Miembro
 
Registrado: abr 2006
Posts: 177
Poder: 21
DarkDudae Va por buen camino
Ante todo, muchas gracias. Funciona perfectamente.

Cuando buscaba una solución, también indagué en la documentación del firebird, pero cuando leí que el srand() era la antigua función rand() que ha sido sustituida recientemente por la rand() actual para evitar que la semilla arrojase valores aleatorios iguales cuando se ejecutaban diversas llamadas en el mismo segundo, la dejé en el olvido:

Cita:
UDFs Added and Changed
IB_UDF_rand() vs IB_UDF_srand()
IB_UDF_lower
UDFs added or enhanced in Firebird 2.0's supplied libraries are:
IB_UDF_rand() vs IB_UDF_srand()
F. Schlottmann-Goedde
In previous versions, the external function rand() sets the random number generator's starting point based on the current time and then generates the pseudo-random value.
srand((unsigned) time(NULL));
return ((float) rand() / (float) RAND_MAX);

The problem with this algorithm is that it will return the same value for two calls done within a second.
To work around this issue, rand() was changed in Firebird 2.0 so that the starting point is not set explicitly. This ensures that different values will always be returned.
In order to keep the legacy behaviour available in case somebody needs it, srand() has been introduced. It does exactly the same as the old rand() did.
No obstante, para mis necesidades, las limitaciones del antiguo rand() no son tales. En fin, cada función tiene sus pros y sus contras.

Un saludo!
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Numero aleatorio de productos principiante22 Impresión 6 04-03-2008 01:24:08
Alguien sabe como usar la Función Rand() en firebird DANNY777 Firebird e Interbase 2 26-01-2008 16:19:17
Select aleatorio JBalda Firebird e Interbase 11 27-06-2007 20:28:23
Orden aleatorio al 7o digito!!! jdattoli Tablas planas 1 20-10-2005 18:15:09
Presentar ordern aleatorio en un Select aerosB4 Firebird e Interbase 4 16-08-2004 12:53:21


La franja horaria es GMT +2. Ahora son las 12:10:29.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi