Author |
Message |
Luffy123
|
Posted: Wed May 09, 2012 8:15 am Post subject: Couple questions |
|
|
What does randomize do?
Whats the difference between
randint
Rand.Int
which one should you use? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Amarylis
|
Posted: Wed May 09, 2012 8:49 am Post subject: RE:Couple questions |
|
|
Rand.Int is a function, randint is a procedure.
The syntax for randint is
Turing: | 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
|
Posted: Wed May 09, 2012 8:57 am Post subject: 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
|
Posted: Wed May 09, 2012 9:31 am Post subject: 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
|
Posted: Wed May 09, 2012 9:33 am Post subject: RE:Couple questions |
|
|
It used to be, but now it does it automatically. It's obsolete now. |
|
|
|
|
|
Amarylis
|
Posted: Wed May 09, 2012 9:43 am Post subject: RE:Couple questions |
|
|
Oh, is it? Sorry, didn't see it in the Obsolete module when I was poking around the predefs |
|
|
|
|
|
Raknarg
|
Posted: Wed May 09, 2012 10:34 am Post subject: RE:Couple questions |
|
|
Is there really an obsolete module? O.o
Oh. So there is. But yeah, it's not necessary. |
|
|
|
|
|
Amarylis
|
Posted: Wed May 09, 2012 12:37 pm Post subject: 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 |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Raknarg
|
Posted: Wed May 09, 2012 1:22 pm Post subject: RE:Couple questions |
|
|
I'm going to be an ignorant programmer for a minute and just suggest deleting them. |
|
|
|
|
|
Amarylis
|
Posted: Wed May 09, 2012 8:22 pm Post subject: 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?" |
|
|
|
|
|
|