Is random function truly random?

Hi guys,
I use an attribute with the random expression to generate a random number and, based on that number, an actor will be spawned. I have almost 100 actors yet Im surprised to see that there's an overwhelming of same actors being spawned over and over again. Is the random function truly random? I searched the forum and saw someone said it's not really random but those posts were over a year ago, I guess it's fixed now, right? How can I truly achieve randomness? Somebody please help me.
For example, I have:
Rule -> If x=1 -> Change Attribute y=random(1,100)
If y = 1 -> Spawn Actor 1
If y = 2 -> Spawn Actor 2
...
If y = 100 -> Spawn Actor 100
Yet I keep seeing an army of actor 3,5,19,20,30 (made up number, don't recall correctly the exact numbers but there are a few jackpot-winners keep being spawned over and over again despite their theoretically 1% chance) being spawned during my 30 times testing the game. Is it the function or is it my rotten luck?
Thanks a lot!
I use an attribute with the random expression to generate a random number and, based on that number, an actor will be spawned. I have almost 100 actors yet Im surprised to see that there's an overwhelming of same actors being spawned over and over again. Is the random function truly random? I searched the forum and saw someone said it's not really random but those posts were over a year ago, I guess it's fixed now, right? How can I truly achieve randomness? Somebody please help me.
For example, I have:
Rule -> If x=1 -> Change Attribute y=random(1,100)
If y = 1 -> Spawn Actor 1
If y = 2 -> Spawn Actor 2
...
If y = 100 -> Spawn Actor 100
Yet I keep seeing an army of actor 3,5,19,20,30 (made up number, don't recall correctly the exact numbers but there are a few jackpot-winners keep being spawned over and over again despite their theoretically 1% chance) being spawned during my 30 times testing the game. Is it the function or is it my rotten luck?
Thanks a lot!
Comments
http://gshelper.com/?p=446
Edit: Beat me to it. I'm not sure about that, sorry.
I blame Rowntrees
I usually find that with these kinds of questions people are not actually after a random distribution (with it's clumping and repetition) - they are really after an even distribution of their sample in a vaguely non-ordered way which is often better for things like games.
A more useful function would be one that takes your sample (let's say 5 different actors / colours / sounds / whatever) and shuffles their order within each run of 5.
So while 'random' would look like this:
32245 25313 41113 53142 33421 . . . . . where you can easily have a number three times in a row or 5 times within 15 numbers.
A 'shuffle' function would look like this:
23415 34152 23451 12354 42135 . . . . . where numbers are evenly distributed.