News Feeds
Unlock The Power of Portability
PSP Vault Logo
Go Back   PSP Forums > PSP-Vault Forum > Development

Reply
 
LinkBack Thread Tools Display Modes
  #31 (permalink)  
Old 08-09-2007, 03:59
Senior Member
 
Join Date: Jul 2006
Location: East Coast USA
Posts: 187
Default

Ok, so its not exactly true per se, but its more random than using the default seed, 0. If you were not initialize the seed, you would get a set of "random numbers" that would repeat after a few thousand iterations. If you use a seed (being the time), you make it so you spit out a different sequence of "random numbers", which change with the time. In essence, none are truly random, but for our use, initializing the random seed as the time does enough.[addsig]
__________________
Homebrew Dev
Reply With Quote
  #32 (permalink)  
Old 08-09-2007, 17:23
Senior Member
 
Join Date: Jul 2007
Location: Montreal - Canada
Posts: 143
Default

sounds good.....
what if you passed (as seed) a call to the random number generator with os.time() as its seed into the random number generator function.
as in....

[code=lua]Math.randomseed(Math.randomseed(os.time()))[/code]

that number would probably be pretty random..... would it even work? dunno, never used LUA.

[addsig]
__________________
I am who I am because of who everyone around me is.
Moderator @ [Only Registered Users Can See Links. Click Here To Register]
[Only Registered Users Can See Links. Click Here To Register]
Reply With Quote
Sponsored Links
  #33 (permalink)  
Old 08-09-2007, 23:58
Senior Member
 
Join Date: Jul 2006
Location: East Coast USA
Posts: 187
Default

I think it wouldn't make a difference.[addsig]
__________________
Homebrew Dev
Reply With Quote
  #34 (permalink)  
Old 08-10-2007, 02:54
Moderator
 
Join Date: Aug 2006
Location: Ontario, Canada
Posts: 1,519
Send a message via AIM to superskull85 Send a message via MSN to superskull85 Send a message via Yahoo to superskull85 Send a message via Skype™ to superskull85
Default

Hey, thanks for the information on math.randomseed(). I have learned about the function ever since I posted this tutorial, I will make an update to this guide soon.

Calling math.randomseed() inside another math.randomseed() I think wouldn't work. I have tested it and if I call:

[code=lua]math.randomseed (math.randomseed (os.time()))[/code]

LUA Player produces an error saying that it excepted a number and got no value. So I would assume that math.randomseed() doesn't produce a number, and therefore cannot be used within another math.randomseed(). I only tested it on LUA Player version 0.20 so I don't know if it would work differently for other LUA Player versions or not.[addsig]
Reply With Quote
Sponsored Links
  #35 (permalink)  
Old 08-10-2007, 03:25
thaiboy's Avatar
Senior Member
 
Join Date: Dec 2006
Location: California
Posts: 2,379
Default

Quote:
Originally Posted by superskull85
Quote:
Originally Posted by thaiboy
I know that we both live in the U.S cause you stated so earlier.
And I also know that the time between certain states isn't extra far...
Like California is approx. 3 hours behind Texas....
When Algebra 2 and pre calc begin to actually help....Yay, glad I'm good at that, now I can do Lua stuff with it...I think.... :-?
If you want to create homebrew then Algebra will help you with understanding how variables will affect your code. If I time I might post an application of such knowledge. Basically if you have knowledge of algebra you will be able to rearrange an equation helping you find other variables based off the information you have. Algebra doesn't help that much though, I would say order of operations and knowledge of trigonometry will help you the most. You should also know how to problem solve, as this will help you find bugs in your code. I can't think of an example of how calculus will help you program but it will help you understand math, which in turn helps you program.

You will likely use a lot of the skills and material you learn in math classes when you are programming, especially if you want to create games. When creating a game you will likely have to calculate coordinates and directions for your characters to take, this can be done by studying math. Learning how to use math will help you in the long run, so if you are learning how to program I would suggest that you also study math.
alright thanks!
Wow, this is looking really complicated now.....[addsig]
__________________
If you have nothing with you, the best entertainment system out there is your imagination. If I\'m offline, leave a message after the snot bubble. email me at [Only Registered Users Can See Links. Click Here To Register] if you have any questions. I\'ll try to answer them.
Reply With Quote
  #36 (permalink)  
Old 08-12-2007, 05:03
Moderator
 
Join Date: Aug 2006
Location: Ontario, Canada
Posts: 1,519
Send a message via AIM to superskull85 Send a message via MSN to superskull85 Send a message via Yahoo to superskull85 Send a message via Skype™ to superskull85
Default

Tutorial updated to include information about math.randomseed(), thanks to pspwner and flyingnome.[addsig]
Reply With Quote
Sponsored Links
  #37 (permalink)  
Old 09-07-2011, 16:13
Junior Member
 
Join Date: Sep 2011
Location: Turkey
Posts: 4
Send a message via ICQ to artyiom
Default if i thought twice in one idea i wouldnt have the same idea

there are many ideas a man can think but if he thinks it twice he thought about another idea which makes his idea nonsense...
Reply With Quote
  #38 (permalink)  
Old 09-08-2011, 13:16
Junior Member
 
Join Date: Sep 2011
Location: Slovakia
Posts: 7
Send a message via ICQ to intooosl
Default the place and time for the time and place

how many time i do not do what i want to do but do what i dont want to do
Reply With Quote
Sponsored Links
  #39 (permalink)  
Old 09-12-2011, 03:43
Junior Member
 
Join Date: Sep 2011
Location: Papua New Guinea
Posts: 2
Send a message via ICQ to jessical
Default the place and time for the time and place

how many time i do not do what i want to do but do what i dont want to do
Reply With Quote
  #40 (permalink)  
Old 09-15-2011, 15:47
Junior Member
 
Join Date: Sep 2011
Location: russia
Posts: 8
Send a message via ICQ to boygotmoves
Default In the past there is that but in the future there will be notihing

how many time i do not do what i want to do but do what i dont want to do
Reply With Quote
Sponsored Links
Reply

Tags
lua, mathematics
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 21:20.



vBulletin Site developed by: vbAlien
Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
Advertisement System V2.6 By   Branden