Page 1 of 1

VL Web - Random Number Generator?

Posted: Wed Jun 15, 2016 3:02 am
by Quinton
Hi!

I have a use for a random number generator in a V14 VL Web application. With the USE command disabled in VL Web, is there an alternative way in VL Web that I can accomplish this?

Thanks!
Quinton

Re: VL Web - Random Number Generator?

Posted: Wed Jun 15, 2016 9:22 am
by Stewart Marshall
Your only choice in RDML today is to execute a SRVRoutine and generate the number on the server.

Alternatively, you could make a widget with a simple routine that uses the JavaScript Math.random

Re: VL Web - Random Number Generator?

Posted: Wed Jun 15, 2016 9:37 am
by Stewart Marshall
Out of curiosity, how random does the random number need to be?

The Chicken Chase Game example (xDemoWebChickenChase) uses milliseconds to randomise between 1 and 9. If you're only producing a value every so often and it's based on a user action, this is a fairly reasonable technique.