
-----------------------------------
Luffy123
Wed May 09, 2012 8:15 am

Couple questions
-----------------------------------
What does randomize do?

Whats the difference between

randint
Rand.Int

which one should you use?

-----------------------------------
Amarylis
Wed May 09, 2012 8:49 am

RE:Couple questions
-----------------------------------
Rand.Int is a function, randint is a procedure.


The syntax for randint is 
procedure randint (var i : int, low, high : int)

Rand.Int acts like randint (it actually calls the same external procedure), but it creates an instance variable to hold the value returned by the procedure, then returns that variable.

-----------------------------------
Raknarg
Wed May 09, 2012 8:57 am

RE:Couple questions
-----------------------------------
I personally like Rand.Int better, because I don't have to rely on a variable. Plus it makes more sense anyways.

Randomize is obsolete. I think what it does is truly randomizes the order number come up in random functions. For instance, in vb, if you don't state Randomize before you use te random function, it'll give you the same list of random numbers each time. It'll randomly generate the same thing each time it runs.

-----------------------------------
Amarylis
Wed May 09, 2012 9:31 am

RE:Couple questions
-----------------------------------
Oh, I completely forgot about checking randomize.


randomize (and Rand.Randomize) "resets the pseudo-random number sequence to a psuedo-random state"


Not sure exactly how useful that is in Turing, but *shrugs*

-----------------------------------
Raknarg
Wed May 09, 2012 9:33 am

RE:Couple questions
-----------------------------------
It used to be, but now it does it automatically. It's obsolete now.

-----------------------------------
Amarylis
Wed May 09, 2012 9:43 am

RE:Couple questions
-----------------------------------
Oh, is it? Sorry, didn't see it in the Obsolete module when I was poking around the predefs

-----------------------------------
Raknarg
Wed May 09, 2012 10:34 am

RE:Couple questions
-----------------------------------
Is there really an obsolete module? O.o

Oh. So there is. But yeah, it's not necessary.

-----------------------------------
Amarylis
Wed May 09, 2012 12:37 pm

RE:Couple questions
-----------------------------------
Yeah, there really are many useless modules, or modules that you wouldn't need in your program, which is why it takes so long to compile (at least for my liking).

To put in perspective, there's 39 predefined modules that are imported implicitly every time you make a new program

-----------------------------------
Raknarg
Wed May 09, 2012 1:22 pm

RE:Couple questions
-----------------------------------
I'm going to be an ignorant programmer for a minute and just suggest deleting them.

-----------------------------------
Amarylis
Wed May 09, 2012 8:22 pm

RE:Couple questions
-----------------------------------
A few of them you can't delete because they actually do something very important (even if, when you look at the coding for them, they seem irrelevant and/or idiotic). Others though, I believe, are kept around simply to help beginner programmers to develop some skills without having to have any understanding of modules and "when the heck do I put the period and when do I not?"
