Problem with RandRange function

I am trying to use the randrange function to randomize some banners I have.  Problem is, it doesn't seem to be going any higher then the number 4

<cfif #story.categoryID# eq 3 OR #story.categoryID# eq 9 OR #story.categoryID# eq 13>
                  <cfparam name="bannerswap" default="#randrange(1, 5)#">
                  <cfif bannerswap is "1">
                        <cfinclude template="random1.cfm">
                  <cfelseif bannerswap is "2">
                        <cfinclude template="random2.cfm">
                  <cfelseif bannerswap is "3">
                        <cfinclude template="random3cfm">
                  <cfelseif bannerswap is "4">
                        <cfinclude template="random4.cfm">
                  <cfelseif bannerswap is "5">
                        <cfinclude template="random5.cfm">
                  </cfif>
            <cfelse>
                  <cfparam name="bannerswap" default="#randrange(1, 7)#">
                  <cfif bannerswap is "1">
                        <cfinclude template="random6.cfm">
                  <cfelseif bannerswap is "2">
                        <cfinclude template="random7.cfm">
                  <cfelseif bannerswap is "3">
                        <cfinclude template="random8.cfm">
                  <cfelseif bannerswap is "4">
                        <cfinclude template="random9.cfm">
                  <cfelseif bannerswap is "5">
                        <cfinclude template="random10.cfm">
                  <cfelseif bannerswap is "6">
                        <cfinclude template="random11.cfm">
                  <cfelseif bannerswap is "7">
                        <cfinclude template="random12.cfm">
                  </cfif>
            </cfif>

Notice how I have 1, 7   or 1, 5.  Well, I cfoutputed   bannerswap and it would never go above the number 4. It would do 1,2,3,4 but never 5,6,7.

Why is that.

Thanks
Bryan
jag5311Asked:
Who is Participating?
 
Renante EnteraSenior PHP DeveloperCommented:
Hello jag5311!

How about changing the following codes :
  <cfparam name="bannerswap" default="#randrange(1, 5)#">
  <cfparam name="bannerswap" default="#randrange(1, 7)#">

Into these codes :
  <cfset bannerswap = randrange(1, 5)>
  <cfset bannerswap = randrange(1, 7)>

Hope this helps.  Just try it.


Goodluck!
eNTRANCE2002 :-)
0
 
jag5311Author Commented:
genious. Pure genious :)

I got this off of easycfm.com.

So far it worked I will let you know and award points.

Thanks
0
 
jag5311Author Commented:
THANK YOU! Works wonderfully. And funny, but it seems like its faster to in terms of how fast my banners show up or get decided to show.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.