GMLscripts.com

Discuss and collaborate on GML scripts
Invert

You are not logged in.

#1 2008-01-09 04:40:43

xot
Administrator
Registered: 2007-08-18
Posts: 1,239

Preposterous Code

Here's one of the more ridiculous scripts I've seen lately:

//chooses a number between argument0 and argument1
choice1=argument0
choice2=argument1

n=random(argument1)

ch=choose(floor(n))

if(argument0<argument1)
{
if(ch<argument0)
{
return random(argument1)
}
}
if(argument0>argument1)
{
if(ch<argument1)
{
return random(argument0)
}
}

Bonus:

EDIT: The script has been fixed

http://gmc.yoyogames.com/index.php?showtopic=350458


Abusing forum power since 1986.

Offline

#2 2008-01-09 14:12:45

waaaaaaah
Member
Registered: 2007-10-23
Posts: 4

Re: Preposterous Code

Wow. This script could certainly use a cleanup.

Offline

#3 2008-01-11 00:33:03

Quimp
Member
Registered: 2007-10-09
Posts: 15

Re: Preposterous Code

bonus #2 wrote:

Wow... you are right... though, i tested the script and it worked fine until you told me that it didnt work, and i tested it again, and it didnt work...

Offline

#4 2008-01-11 02:09:19

Yourself
Member
Registered: 2007-10-09
Posts: 48

Re: Preposterous Code

It's like a quantum script.  The outcome changed when he measured it.

Offline

#5 2008-01-11 19:23:19

EyeGuy
Member
Registered: 2007-10-18
Posts: 19

Re: Preposterous Code

What the... hell.  A silly-straw distribution?

If argument0 is less than argument1, there's an argument0/argument1 chance that it'll return a random number between 0 and argument1.

If argument0 is greater than argument1, then it'll return a random number between 0 and argument0.

It's like a quantum script.  The outcome changed when he measured it.

Ha.

Offline

Board footer

Powered by FluxBB