Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Random Number
Random Number
2002-09-19, 2:05 PM #1
Is there a function or someway to create a random number?

------------------
Script Warehouse
The Jedi's Saber
2002-09-19, 3:21 PM #2
Code:
intnum = randInt(1,5);

Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2002-09-19, 3:50 PM #3
Okidokee thanks.

------------------
Script Warehouse
The Jedi's Saber
2002-09-19, 4:32 PM #4
Uhh, Gris, if this is for cog, it would be

Code:
Number = Rand();


------------------
I used to believe that we only want what we can't have. I was wrong. The truth is, the wonderful truth is, we only want what we think we can't have.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.
2002-09-19, 4:36 PM #5
Omg does that work? I never saw an documentation on RandInt(), just Rand().


Quote:
<font face="Verdana, Arial" size="2">Originally posted by Grismath:
Code:
intnum = randInt(1,5);


[/b]</font>

- Wisdom is 99% experience, 1% knowledge. -
2002-09-20, 3:42 AM #6
RandInt() isn't in cog, its in TI-83+ prog, I think C/C++, but not cog.

------------------
The Sniper Missions. Current project, The Sniper Missions

The Magician Saber System.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-09-20, 9:40 AM #7
Eh, Grismath, why in the world did you post that? Of course there's no RandInt() in Cog.

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-09-21, 12:04 AM #8
Oh God, that is TI-83+ I was really out of it.
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2002-09-21, 5:19 AM #9
[http://www.just4yucks.com/images/5x/59214.gif]

J/K . . . [http://forums.massassi.net/html/biggrin.gif]

------------------
I used to believe that we only want what we can't have. I was wrong. The truth is, the wonderful truth is, we only want what we think we can't have.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.
2002-09-22, 2:24 PM #10
Quote:
<font face="Verdana, Arial" size="2">Originally posted by Grismath:
Oh God, that is TI-83+ I was really out of it.</font>


Don't feel so bad, I'm having to relearn BASIC to pass my comp prog class, no While, nor For loops, and many more commands that aren't there. Scary. But still, I'm always having to erase semi-colons at the end of each line of BASIC. So use to C/C++ and cog. [http://forums.massassi.net/html/redface.gif]

------------------
The Sniper Missions. Current project, The Sniper Missions

The Magician Saber System.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-09-22, 3:15 PM #11
Most BASICs have For To Step, Do While, and While loops. Not having them would be a severe limitation.

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.

[This message has been edited by SaberMaster (edited September 23, 2002).]
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-09-23, 3:52 AM #12
Only type of loop are BASIC will accept is a goto loop.

------------------
The Sniper Missions. Current project, The Sniper Missions

The Magician Saber System.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-09-23, 7:00 AM #13
What compiler are you using?

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-09-23, 9:25 AM #14
QBASIC, I think... Maybe I'm just doing something wrong with my arguments, and that is why it doesn't work. I dunno.

------------------
The Sniper Missions. Current project, The Sniper Missions

The Magician Saber System.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-09-23, 11:45 AM #15
I know QBasic uses those loops. Look them up in its help documentation.

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-09-23, 4:05 PM #16
I take back the part about the For loop, but it doesn't have a pause statement. BTW - this is for my Comp Prog class (i'm only doing it for the C/C++) and we have no help docs or mannual. *sigh* Its hard.

------------------
The Sniper Missions. Current project, The Sniper Missions

The Magician Saber System.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-09-23, 11:00 PM #17
QBasic has a sleep or pause function. But vb doesnt...
Team Battle.
2002-09-24, 2:45 PM #18
Haven't tried sleep yet, but there is definatly no pause, except using pause as a variable and a long FOR loop. Of course I could be wrong about this whole thing... *shrugs*

------------------
The Sniper Missions. Current project, The Sniper Missions

The Magician Saber System.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-09-24, 3:46 PM #19
Yeah, QBasic uses a Sleep statement. And the documentation I was refering to is QBasic's help index, not a manual. Anyways, good luck with your programming class. [http://forums.massassi.net/html/wink.gif]

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-09-24, 7:52 PM #20
If you want to generate a random number up to a certain limit, use number=rand()*limit, and it'll generate numbers between 0 and whatever you plug in for 'limit.' I haven't figured out how to set a minimum, but you shouldn't really need one.

I'm the RandMan, I have a rand() command in all of my mods, at least once. Usually several times.
***POST COUNT +1!***
2002-09-25, 3:23 AM #21
Code:
Rand_num = min - 1;
While(Rand_num < min) 
Rand_num = Rand() * max;



[http://forums.massassi.net/html/biggrin.gif]

------------------
I used to believe that we only want what we can't have. I was wrong. The truth is, the wonderful truth is, we only want what we think we can't have.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.
2002-09-25, 4:22 AM #22
Or
Code:
 rand = rand()*max + min;

GBK, are you sick? [http://forums.massassi.net/html/tongue.gif] Thanks for the luck SaberMaster, BTW - I mentioned you in this Favorite Massian thread. [http://forums.massassi.net/html/wink.gif]

------------------
The Sniper Missions. Current project, The Sniper Missions

The Magician Saber System.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-09-25, 4:25 AM #23
Uhh, DP, that might push the number past the max value. My way is better.

------------------
I used to believe that we only want what we can't have. I was wrong. The truth is, the wonderful truth is, we only want what we think we can't have.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.
2002-09-25, 4:37 AM #24
Push the value past max? Just adjust max. Pilot's solution is IMO better, because yours could take a lot of cpucycles to compute...

------------------
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2002-09-25, 4:44 AM #25
Yeah. It might take a whole picosecond on my 386. Such a terrible waste... [http://forums.massassi.net/html/rolleyes.gif]

------------------
I used to believe that we only want what we can't have. I was wrong. The truth is, the wonderful truth is, we only want what we think we can't have.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.
2002-09-25, 7:23 AM #26
I'm honored. [http://forums.massassi.net/html/smile.gif]

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-09-25, 12:08 PM #27
GBK, the more you have to type the more of a poassiblity fore you ot makre mitakees. [http://forums.massassi.net/html/wink.gif])

------------------
The Sniper Missions. Current project, The Sniper Missions

The Magician Saber System.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-09-25, 1:01 PM #28
Bah. Admit it, your just jealous that you didnt think of it first.

------------------
I used to believe that we only want what we can't have. I was wrong. The truth is, the wonderful truth is, we only want what we think we can't have.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.
2002-09-26, 4:46 AM #29
The only one I'm jelous of is SaberMaster. [http://forums.massassi.net/html/tongue.gif]

------------------
The Sniper Missions. Current project, The Sniper Missions

The Magician Saber System.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack

↑ Up to the top!