They should be passed in.  The hardcoded zeros are defaults which
actually result in the next() function returning any number within the
range of an integer.  The component is meant to be used like this:

<cfset rng = createObject("component", "com.macromedia.util.Random)/>
<cfset rng.setBounds(1, 52)/>
<cfoutput>#rng.next()#</cfoutput>

You can also do this...

<cfset rng.setSeed(getTickCount())/>
<cfset rng.nextBoolean()/>

I think I would create in instance during your initialization routine
(probably in your Application.cfm file), stash the instance in a
persistent scope, and use it like this:

<cfoutput>#application.rng.next()#</cfoutput>

You can also reset the bounds at any time without having to create a
new instance.

Christian

On Monday, January 26, 2004, at 10:54  AM, Tony Weeg wrote:

> so do you hardcode your min/max at the top of the cfc?
>
> you don't pass them in right?
>
> tony
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to