Random Number Generation And Probability


Posted on 16th Feb 2014 07:03 pm by admin

Hello, I am working on a function which has to insert data into a SQL table.

we have to supply the function with number of entry needs to be inserted into the database and the work of the function is to insert the entry into SQL in such a way that 30% of the entry have their type(a column in my db) as 'a' , 20% as 'b' , 40% as 'c' and rest 10% as 'd'.

Is there any way i can do this? Do I need to run 4 while loops?

Thanks.

No comments posted yet

Your Answer:

Login to answer
347 Like 54 Dislike
Previous forums Next forums
Other forums

Multi language - seo links
Im trying to figure out the best method to have a multi language website that will function with seo

Getting PHP to ammended the selected in option field
Hey Guys

thanks for everyones help so far. This site and its users are oozing awesomness.

Standard DES encryption script?
Can anybody point me to a tutorial or a short script that shows how to encrypt some text with salt i

Table colours fail when extra row added
Hey Gurus,

I got a weird problem with formating the colour of a table made in php. Everything

PHP login form help (Done Most of It)
Hi i am having a problem, when i try logging in it is always saying "Invalid Login" im not

help retrieiving results and doing pagination
Having some trouble trying to get the results to show on more than just one page.

What is ha

How to read posted binary data from a mobile device and post it to a web server?
Here is the senario...

I have a mobile device (MD) that posts binary data to a Web Server (WS

I have a parse error in this query help..
Code: $query1="INSERT INTO `rating` (`item_name`, `rating`, `ip_address`, `date_rated`) VALUES

Working with Dates, help.
Sooo to make a long story short, here's what im trying to accomplish.

I need to create a drop

isset undefined variable
Hi all,

Hope someone can point out the obvious. I've a log in script, if you dont enter a use

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash