Computer Science Canada

question about commands.......

Author:  recneps [ Sat Dec 27, 2003 8:29 pm ]
Post subject:  question about commands.......

question about commands...
i was just wondering, everyone here uses
Rand.Int
Draw.Line
..
..
etc
whereas im used to randint, drawline, etc
are they any different? more efficient? or you just like them better? lol

Author:  AsianSensation [ Sat Dec 27, 2003 9:02 pm ]
Post subject: 

I don't know about it being more efficient, but for me, I use some of those because they are functions instead of procedures. Rand.Int is a function, it could be used in if statements, as part of a equation, etc, etc, more versatility I guess.

I'm not too sure about Draw.Line, I still use drawline, I don't see a difference, perhaps other than the organizational level.

Author:  Thuged_Out_G [ Sat Dec 27, 2003 11:18 pm ]
Post subject: 

dont qoute me on this...i dont use it, but i believe randint is different...dont you assing a variable to it? like such

code:

randint(variable,1,10)


whereas Rand.Int you assign it to a variable

code:

variable:=Rand.Int(1,10)

Author:  Mazer [ Sun Dec 28, 2003 7:24 am ]
Post subject: 

exactly.

Author:  recneps [ Sun Dec 28, 2003 10:46 am ]
Post subject:  k

but in essence, they are the same thing, they just have a period in the middle?

Author:  AsianSensation [ Sun Dec 28, 2003 12:22 pm ]
Post subject: 

let's say you want to access a random member of your 3 dimensional array, with randint, you would have to declare three variables, and write out the thing in like alot of lines.

code:
var pos : array 1 .. 100, 1 .. 100, 1 .. 100 of int
var x, y, z : int

randint (x, 1, 100)
randint (y, 1, 100)
randint (z, 1, 100)

pos (x, y, z) := 0


with Rand.Int:

code:
var pos : array 1 .. 100, 1 .. 100, 1 .. 100 of int

pos (Rand.Int (1, 100), Rand.Int (1, 100), Rand.Int (1, 100)) := 0


see, it's easier this way.

Author:  Thuged_Out_G [ Sun Dec 28, 2003 3:33 pm ]
Post subject:  Re: k

recneps wrote:
but in essence, they are the same thing, they just have a period in the middle?


they are the same "in essence", they do the same thing, but i prefer Rand.Int, because you dont need to have a variable to use it, and because it can be used in equations or for loops, or just about anything involving a number

code:

for i:1..Rand.Int(2,100)
end for


code:

Draw.Line(Rand.Int(1,100),Rand.Int(100,200),Rand.Int(1,100),Rand.Int(100,200),Rand.Int(1,255))

Author:  recneps [ Sun Dec 28, 2003 8:59 pm ]
Post subject: 

i see, ok. So its a newbie way with randint and expert way (you can do more with it, easier) with rand.int

Author:  AsianSensation [ Sun Dec 28, 2003 9:51 pm ]
Post subject: 

recneps wrote:
i see, ok. So its a newbie way with randint and expert way (you can do more with it, easier) with rand.int


more like the lazy bum's way with Rand.Int Laughing

Author:  recneps [ Mon Dec 29, 2003 1:41 pm ]
Post subject: 

lol, thats me! Very Happy


: