Thanx Ivan,well I guess your doing something wrong, because this works fine for me.Guess it is my lucky day
Any ideas why that’s the case?Now i’m getting a returned value! The only thing is…. the only return value that i get is 0.
![]()
![]()
Guess your right
. when i put it in another flie, it works perfect 
function AnimateGrid():Void {
for(var v=0; v < arrGrid[0][1]; v++) { // vertical pixels
vpos = v * psize;
for(var h=0; h<arrGrid[0][0]; h++) {
index++;
hpos = h * psize;
var pv = bmp.getPixel(hpos,vpos);
var ps = symbols.attachMovie("mcSymbols_holder","s"+index,index,{_x:hpos,_y:vpos,_alpha:0});
mc_text.alphaTo(100, 1, "easeOutCubic");
var cw = ColorAmount("0x"+pv.toString(16));
if(cw >= 0 && cw <= 20) {
ps.pos = 6;
ps.cover = 10;
} else if(cw > 20 && cw <= 35) {
ps.pos = 5;
ps.cover = 50;
} else if(cw > 35 && cw <= 50) {
ps.pos = 4;
ps.cover = 50;
} else if(cw > 50 && cw <= 65) {
ps.pos = 3;
ps.cover = 50;
} else if(cw > 65 && cw <= 80) {
ps.pos = 2;
ps.cover = 30;
} else {
ps.pos = 1;
ps.cover = 10;
}
var date:Date = new Date(); //we use date to get different seeds
//seeds
var m_w:Number = date.getSeconds()+1;
var m_z:Number = date.getMilliseconds()+1;
//Marsaglia's MWC algorithm
function GetUint():Number
{
m_z = 36969 * (m_z & 65535) + (m_z >> 16);
m_w = 18000 * (m_w & 65535) + (m_w >> 16);
return (m_z << 16) + m_w;
}
function GetUniform():Number
{
var u:Number = GetUint();
return (castToUint(u) + 1) * 2.328306435454494e-10;
}
//100 random numbers
for(var i=0; i<100; i++){
trace(GetUniform()+0.5|0);
}
function castToUint(x:Number):Number{
return x < 0 ? x+4294967295 : x;
}
// this is the Math.random() i have to change
ps.symbols.gotoAndPlay(Math.round(Math.random() * 5 + 1));
ps._alpha = Math.round(Math.random() * 100); // ps.cover;
var delay : Number = Math.round(Math.random() * 2000 + 1000)
setTimeout(ShowTile, delay, index, delay);
trace(Math.round(Math.random() * 5 + 1));
}
}
}
But when i put the code inside my function it only returns 0 
well you cant put all this inside one function just like that 
You have to watch on scope. Paste all this code beside other functions not inside. And then just use GetUniform()+0.5|0; to get random number inside your function or wherever you need it.
I must go now, hope I helped you 
cya
Ivan
Ivan,
Thank you very much!!! 
I’ve got it to work!!! 
replaced GetUniform()+0.5|0 for Math.round(GetUniform()); and delete the for loop!!!
Guess it was my lucky day after all 
