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

Drop Down and text box issue
Is it possible to set a drop down list and text boxes to a certain width?

here is my code

User registration and login
I don't know whether this is the correct forum, if not i apologise but am pretty desperate at the mo

PHP - MySQL Fail
My PHP code will only execute the first part of my code...

Code: <?php

sessio

FTP Programs
Here is a list of commonly suggested FTP Programs to use:

FileZilla
SmartFTP
CuteFTP

Multithreading design
Hi

I have come up with a Singleton class that manages a pool of database connections. Basical

How to add an image/C++ OpenGL?
Hi,

I have been trying to look online for this and, so far, I haven't found anything usef

Libraries in C++
Hi all,

I have two libraries. one is based targeted on linux platform and uses another li

mail with attachment problems
Hi. I have the following code:
Code: else if(file_exists("site".$timp.".zip")

Two warning messages
Quote<b>Warning</b>: mysql_real_escape_string() expects parameter 1 to

Best way to cross matching large datasets
Hi,

Im running a script where am I cross matching about 200 000 data sets with each other. Ea

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