Ver Mensaje Individual
  #2 (permalink)  
Antiguo 25/05/2011, 02:00
quimfv
Colaborador
 
Fecha de Ingreso: marzo-2008
Ubicación: Sabadell
Mensajes: 4.897
Antigüedad: 16 años, 1 mes
Puntos: 574
Respuesta: Resultados con "peso" específico

En el manual en ingles te dan una solución si he entendido bien tu problema.

http://dev.mysql.com/doc/refman/5.0/...#function_rand

Cita:
To obtain a random integer R in the range i <= R < j, use the expression FLOOR(i + RAND() * (j – i)). For example, to obtain a random integer in the range the range 7 <= R < 12, you could use the following statement:

SELECT FLOOR(7 + (RAND() * 5));

RAND() in a WHERE clause is re-evaluated every time the WHERE is executed.
en principio FLOOR(1 + (RAND() * 2)) debería dar 1 o 2 al 50%...
__________________
Quim
--------------------------------------------------
Ayudar a ayudar es una buena práctica!!! Y da buenos resultados.