View Single Post

   
  #2 (permalink)  
Old 02-28-2008, 07:37 AM
Peter H. Coffin
 
Posts: n/a
Default Re: RAND() generating same number in rapid sequence

On Sat, 22 Apr 2006 18:47:49 -0700, Jim Michaels wrote:
> I am using RAND() in rapid sequence, possibly on different
> connections. I expected to get different numbers from RAND(). I
> didn't. I get the same number within a given timeframe - it's like
> it's driven entirely by microtime. Am I stuck?
>
> I need different numbers for images. The only solution I can think of
> is to get 'the next image' from the database. to make it look random.
> but that's not very random.
>
> any ideas?


Generate your random number on the application level? Use an
autoincrement column instead of a random one? Start with telling us what
problem you're trying to solve rather than telling us your not-working
solution. That is, "I want to have a unique file name I can give to an
image associated with information stored in a table" instead of "RAND()
isn't random enough, so I can't make a file name out of it and guarantee
uniqueness".

--
100. Finally, to keep my subjects permanently locked in a mindless trance, I
will provide each of them with free unlimited Internet access.
--Peter Anspach's list of things to do as an Evil Overlord
Reply With Quote