07 November 2007

Google AdWords and Math.random

A colleague just came across a problem with a Flash banner when uploading it to Google AdWords.

The banner contained an effect where many movie clips were randomly generated and positioned. Yet when uploaded to Google AdWords, an error occurred stating that random numbers could not be used.

The problem is with Math.random, Google AdWords doesn't allow it. We called the AdWords help desk and they confirmed that Math.random cannot be used, but were unable to give a reason why.

Is this a security hole in Flash? LiveDocs say Math.random is "calculated in an undisclosed manner", so does it use the client hardware to generate that number? I'm now intrigued, if anyone can shed some light on this please comment.

4 comments:

ddwnl said...

Yes it does. The RAM Size, the CPU Banwith (MHz/GHzit operates on), the Clock/Bus-speed all determine the speed, accuracy, correctness, randomness and preciseness of a random number. This means if you have the fastest PC in the world (or over-clocked your current one with liquid-nitrogen to 5+GHZ) will get a more accurate and greater or lower number depending on the way a Math.random is used. (exp.: Math.random()*10 vs. Math.random()*-10).

As to why Google not allows is, according to what I know, it would interfere with Google's handling of their AdSense scripts (the script a user incorporates in his/her website, and display your ads and/or any RANDOM generated relevant ads based on the sites content)

Unknown said...

Here's a guess. Some old version of the flash player implements random by reading from preset locations in the client's memory. It is probably a security problem.

Leeeboy said...

I'm not sure if this sheds any light on anything at all, but I'm receiving the same error in AdWords while attempting to load my swf into the system - through extensive trial and error, I think the "random number" is derived from a single use of Math.random within a private function in the caurina Tweener class.

Anybody got a workaround that doesn't involve abandoning caurina Tweener? I hate to think my coding is too complex for google to deal with, but they're rejecting a private function in a class that doesn't even need to have a property called to break the script. I can't believe that would impact the ad negatively in any practical sense...I know their specs say no random math, but this is a little more abstract, I think. And the ad is otherwise bulletproof - I have hundreds of millions of impressions under my belt through adwords.

Basically I can't believe Google can't deal with Tweener. It's phenomenally useful, as I've discovered through non-ad work. Update your system Google!

Help?

ASHA said...

"Hi, I Saw Your Link in Bing.com I Love Your Blogs Kindly See my Link
Here a New Alternative Money Making Ad Network adsense here

"