Random Numbers

EQ2Emulator Development forum.

Moderator: Team Members

Post Reply
User avatar
Eradani
Posts: 192
Joined: Wed May 05, 2010 6:25 am
Location: Saskatchewan

Random Numbers

Post by Eradani » Fri Jun 11, 2010 8:32 am

what are we using for random number generation? is it in C++ or LUA
(couldn't find anything in http://www.eq2emulator.net/wiki/index.p ... _Functions concerning random numbers)

what is it returning?
a) random() = float 0.0 .. 0.999999999
b) random(10) = 1..10
c) random(10) = 0..9
d) random(7, 14) = 7..14
my client version: 12682L, 2016/06/06
last one that will run on XP cause i'm just a stick-in-the-mud

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Re: Random Numbers

Post by Scatman » Fri Jun 11, 2010 1:32 pm

It depends where you want to use it. In the server code you can use rand(). I also remember I implemented at least one random number generating function in common/miscfunctions.cpp. In LUA you can use math.random().

User avatar
Eradani
Posts: 192
Joined: Wed May 05, 2010 6:25 am
Location: Saskatchewan

Re: Random Numbers

Post by Eradani » Sat Jun 12, 2010 7:35 am

sorry, must have been 1/2 asleep when i asked this. found the Lua Reference manual and, of course at the bottom of a pile of books, my [url=desk://topOfPile.Books]C++ manual[/url].
my client version: 12682L, 2016/06/06
last one that will run on XP cause i'm just a stick-in-the-mud

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Re: Random Numbers

Post by Scatman » Sat Jun 12, 2010 10:27 am


User avatar
Eradani
Posts: 192
Joined: Wed May 05, 2010 6:25 am
Location: Saskatchewan

Re: Random Numbers

Post by Eradani » Sat Jun 12, 2010 10:57 am

hehe, you didn't look at the link for
Eradani wrote:my [url=desk://topOfPile.Books]C++ manual[/url].
my client version: 12682L, 2016/06/06
last one that will run on XP cause i'm just a stick-in-the-mud

User avatar
Zcoretri
Team Member
Posts: 1642
Joined: Fri Jul 27, 2007 12:55 pm
Location: SoCal

Re: Random Numbers

Post by Zcoretri » Sat Jun 12, 2010 11:11 am

Eradani wrote:hehe, you didn't look at the link for
Eradani wrote:my [url=desk://topOfPile.Books]C++ manual[/url].
Invalid link for me url=desk:topOfPile.Books

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Random Numbers

Post by John Adams » Tue Jun 15, 2010 1:49 pm

These guys are kinda thick, huh?

User avatar
Eradani
Posts: 192
Joined: Wed May 05, 2010 6:25 am
Location: Saskatchewan

Re: Random Numbers

Post by Eradani » Tue Jun 15, 2010 3:36 pm

good thing i don't make platz telling jokes
my client version: 12682L, 2016/06/06
last one that will run on XP cause i'm just a stick-in-the-mud

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests