Highlighted

Generate random number

kc

21-10-2008

Hi all,



Does anyone know how I can generate a random number?



My idea is that I can create a loop for handling the indexes of a string one by one, but I don't know if it is possible to get a single random number.



Of course I could create my own custom service as well, but I would like to use the stand alone services first and fore most if it is possible.



Is it possible without a custom service?



Thanks in advance



Sincerely

Kim

Replies

Highlighted

pguerett

21-10-2008

There are functions in Javascript for this. Did a search on the web and come up with this one:



var num=Math.floor(Math.random()*1000)



Where num will contain a random number between 0 and 1000. If you want a different range change the 1000 to your max range.
Highlighted

kc

21-10-2008

Thanks a lot Paul, that is very usefull, allthough I would have liked it to be possible without using the script-service.



Thanks again, I really appreciate it



Sincerely

Kim