Why won't random(random(60,90),random(230,260)) work?

Hey guys, i am trying to spawn an actor in a random spot on the left or the right side of the screen but not in the middle. I thought using random would work, when I give the min value a random number as well. But it doesn't seem too. Any ideas? Thanks.
SM
SM
Comments
You must understand your mistake , its very important !
Lets break down what you did :
Random 1 :
random(60,90) - lets say i came out 80
Random 2 :
random(230,260) - lets say it came out 240
Random 3- the result of the two above :
random(80,240) - it can be in the middle of the screen thats why it doesn't work for you !!
Now for a solution :
you can use a table for this but I'm gonna explain it to you in the old fashion way instead.
Make a self attribute - index- call it "spawn left or right"
Now make a change :
Change "self.spawn left or right" to random(0,1)
Now make 2 rules-
When "self.spawn left or right" = 0 (for the right side)
Spawn in random(230,260)
When "self.spawn left or right" = 1 (for the left side)
Spawn in random(60,90)
That should work for ya