Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Mike Helland wins the beaty contest :)
Message
 
 
À
13/03/2000 04:13:39
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00343673
Message ID:
00345056
Vues:
24
Auke,

I've just wrote a simple test program:
********************************************************************
*  Description.......: TestRandom
*  Calling Samples...: TestRandom (100)
*  Parameter List....: pNumber
*  Created by........: Nadya Nosonovsky 03/13/2000 01:38:52 PM 
*  Modified by.......: 
********************************************************************
lparameters pNumber

if type('pNumber')<>'N' or pNumber<0
   pNumber=100
endif
   
CLOSE DATABASES
CREATE TABLE Random (Rand1 N(3), Rand2 N(3))
gnLower = 1
gnUpper = 50

FOR nItem = 1 TO int(pNumber)   
   APPEND BLANK
   lnRand1=INT((gnUpper - gnLower + 1) * RAND( ) + gnLower)
   lnRand2=INT((gnUpper - gnLower + 1) * RAND( ) + gnLower)
   REPLACE Rand1 with lnRand1, rand2 with lnRand2  && Insert random values
ENDFOR

select rand1, count(*) as cntt from Random;
       group by rand1 ;
       order by 1

select rand2, count(*) as cntt from Random ;
       group by rand2;
       order by 1
 
>
>My example was per drawing [per day]. Let's just say your odds are 1 in 1000 of being selected on any 1 day. Over a 20 day period, your odds become additive --
>
>1/1000 + 1/1000 .... or 20/1000 or 1 in 50.
>
>
>Adding probabilities is not right: in 2000 days you would get 2 in 1, which is obviously ridiculous. You could either calculate the probability of not being selected: (999/1000)^20 is the probablity of not being selected in 20-day period. So, the being selected at least once: 1-(999/1000)^20 (about 0,20).
>
>
>
>Auke
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform