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.