generation of random numbers in java
- by S.PRATHIBA
Hi all,
I want to create 30 tables which consists of the following fields.For example,
Service_ID         Service_Type                              consumer_feedback 
     75         Computing                                  1                 
     35           Printer                                  0                 
     33           Printer                                  -1                
3 rows in set (0.00 sec)
mysql select * from consumer2;
Service_ID            Service_Type                             consumer_feedback   
42                          data                                      0
75                           computing                                0
mysql select * from consumer3;
Service_ID                 Service_Type                  consumer_feedback 
        43                    data                                -1
         41                   data                                 1 
          72                 computing                              -1
As you can infer from the above tables,  i am getting the feedback values.I have generated these consumer_feedback values,Service_ID,Service_Type using the concept of random numbers .I have used the funtion
    int min1=31;//printer
    int  max1=35;//the values are generated if the Service_Type is printer.
   int provider1 = (int) (Math.random() * (max1 - min1 + 1) ) + min1;
    int min2=41;//data
    int max2 =45
     int provider2 = (int) (Math.random() * (max2 - min2 + 1) ) + min2;
   int min3=71;//computing
    int max3=75;
    int provider3 = (int) (Math.random() * (max3 - min3 + 1) ) + min3;        
    int min5 = -1;//feedback values
int max5 =1;
int feedback = (int) (Math.random() * (max5 - min5 + 1) ) + min5;
I need the Service_Types to be distributed uniformly in all the 30 tables.Similarly I need feedback value of 1 to be generated many times other than 0 and -1.Please Help me.