randomly generated field values

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Faithe
Forum Commoner
Posts: 33
Joined: Tue Jul 12, 2005 3:26 pm
Location: WA

randomly generated field values

Post by Faithe »

The website I'm making is a SIM game, and one of the components involved are randomly generated "band members."
Each band member has twelve different skills, each skill given a ranking from 1-10.

I'd like to be able to write a script that allows me to create X number of randomly generated band members at the same time, each having their age, gender, and skill points generated and added into the database.

I would very much appreciate it if anyone could point me in the right direction towards accomplishing this :] I'd be happy to explain further, if needed.

Thanks.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Post by VladSun »

There are 10 types of people in this world, those who understand binary and those who don't
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Post by VladSun »

Oops, double post :(
There are 10 types of people in this world, those who understand binary and those who don't
Faithe
Forum Commoner
Posts: 33
Joined: Tue Jul 12, 2005 3:26 pm
Location: WA

Post by Faithe »

Oh, perfect. Why didn't I think of that? ;]

One other thing. Is there way to make it so there's a higher chance of getting say, 5-10, than there is of getting 1-5?
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Create an array of the values that you want duplicating the values that you need to show more often then not a couple times and then use array_rand()
Post Reply