James WrightMainWorkInfo

Google AdWords doesn’t allow Math.random() in its files

Google AdWords Math.random() Error

I created a banner for a site a month or 2 ago and the company decided they wanted to re-work it for their AdWords campaign, so a designer here at work used the class I built to re-build the ad in a bunch of AdWords sizes. All seemed peachy... Then upon uploading the ads our media person was given the error "Encountered flash error - ad cannot have random numbers".

We contacted their customer support via phone and the only reason they could give us was that "it is possible that random numbers can be used maliciously". They would not give us anymore information beyond that. I really do not see how a random number can be used maliciously other than calling a random script, but AdWords already throws an error for calling outside scripts.

I suppose I could generate out a list of random numbers and use them in an array as follows:

 
var _counter:Number = -1;
 
var _random:Array = [
 
0.404158900026232,
 
0.717061429284513,
 
0.776794651523232,
 
0.924381226301193,
 
0.349322804249823,
 
0.271397457458079,
 
0.840603074524552
 
];
 
function randomNumber():Number {
 
 _counter++;
 
 return _random[_counter];
 
}

Theoretically I should be able to just do a find and replace of Math.random() with randomNumber() . It won't be different every time but at least I should be able to maintain the "random" look of how the items are positioned.

Leave a Reply