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

Using the $_GET variable to view certain records
Hello,

First let me explain my problem, I have 2 pages the first page pull a list of Guide ti

preg-match with a string and numbers
Hi, I can't get the expression to work for my preg_match, what I'd like is for it to match the strin

$_FILES array
Ok,

I just started experimenting with PHP today. My goal right now is to have people be able

Adding Outlook 2007 items via file upload
I am looking for a way to be able to attach an Outlook item (an email message) in an ASP.NET 3.5 app

gmdate() - want 1 hr before time
Hi,
I am using php gmdate().
Now I am entering all dates in my dbase using gmdate("Y-m-d

array_combine() trouble w/csv file
I have a problem with a piece of code I wrote to import some records from a csv file into mysql. I h

insert Multiple rows into the table from that table data
Hi All,

I have a requirement like to insert mulitple rows into the table from that

Remove Rows From Database ad
Hi All,

I have this:

Code: [Select]<?php
session_start();
include('../com

square instead of number
Hello
I do not know why but this code seems to work fine only in my xampp local insallation but n

search function
HI guys,

if anyone could point us in the right direction of how to do this, or provide some t

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