View Full Version : Random Number Generator

04-02-2003, 01:06 PM
I need help with a random number generator. Here is an excerpt of an email I received of what it needs to do:

CACHE BUSTING: To ensure accurate tracking, you are required to implement a Cache Buster on these placements by replacing all occurrences of [CACHEBUSTER] in the ad tags below with a value using one of the following two Cache Buster types:

1. Time Date Stamp (down to the millisecond or smaller time interval)
2. Random Number Generator (at least 4 digits)

The Cache Buster value must be identical on all ad tag components for each ad placement.

Proper cache busting ensures the correct click thru URLs are delivered, and ensures correct banner weighting/rotation.

This is for a banner obviously. So it has to have at least 4 digits and something that I can just put in place of [CACHEBUSTER] in my code.

I really appreciate any help as I haven't a clue on how to do this.

04-02-2003, 02:24 PM
the random number:

<script language="jav&#97;Script">
<!-- ;
function getR() {
return Math.random().toString().substring(2,6)
// end hide -->

Just call the function


in place of cachebuster.

04-02-2003, 03:19 PM
Or, if you want the timestamp

function getR()
return new Date().getTime();

04-02-2003, 03:35 PM
Thanks a lot! I'll give these a try!