我正在对一个横幅,将去谷歌广告网络。然而,谷歌不接受在代码中使用math.random的广告。
我找到了很少的代码,但它不能工作。我找到的最相关的是这个,但仍然不能在我的http://wondergiant.com/2013/03/random-without-math-random/上工作
有人能在这方面帮我吗?它在AS2上是如何工作的?
原文如下:
var pressed = false;
var go = function() {
width = 300;
height = 200;
max_snowsize = 20;
snowflakes = 15;
for (i=0; i<snowflakes; i++) {
t = attachMovie("snow", "snow"+i, i);
t._alpha = 40+Math.random()*60;
t._x = -(width/2)+Math.random()*(1.5*width);
t._y = -(height/2)+Math.random()*(1.5*height);
t._xscale = t._yscale=50+Math.random()*(max_snowsize*10);
t.k = 1+Math.random()*2;
t.wind = -1.5+Math.random()*(1.4*3);
t.onEnterFrame = mover;
}
};
mover = function() {
this._y += this.k;
this._x += this.wind;
if (this._y>height+10) {
this._y = -20;
}
if (this._x>width+20) {
this._x = -(width/2)+Math.random()*(1.5*width);
this._y = -20;
} else if (this._x<-20) {
this._x = -(width/2)+Math.random()*(1.5*width);
this._y = -20;
}
if(pressed){
this._alpha -= 1;
}
}
// start snow
go(); 发布于 2014-11-26 01:57:38
如果您可以找到获取横幅中当前时间方法,请使用该时间值作为种子来运行您的自定义算法。只有当你得到随机种子时,你才能生成随机,甚至可能是你能获得的任何信息,页面浏览量,在线用户,系统处理器使用情况,(我相信所有这些访问都是受限的。横幅使用as2而不是as3是有原因的),但您可能会发现一些漏洞:)
哦,有一种方法可以捕获用户滚动轮的使用情况--我相信这是一个很好的种子,或者至少鼠标悬停事件可以是岸上的种子。
https://stackoverflow.com/questions/27108258
复制相似问题