Advertisement
Guest User

Untitled

a guest
Nov 18th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. T=20
  2. p=0
  3. wynik=c()
  4. for (i in 1:100){
  5. xs1=runif(1,min=0,max=100) #z rozkładu jednorodnego (domyslnie 0-1), zmieniamy na 0-100
  6. xs1 #czas zdatności systemu s1
  7. xs2=rgamma(1,shape=100,scale=10)
  8. xs2 #czas zdatności systemu s2
  9. y=rexp(1,0.5)
  10. y
  11.  
  12. if(xs2<xs1){
  13.   x=xs1
  14. }else{
  15.   if (y+xs1<xs2){
  16.     x=max(xs1+y+xs1,xs2)
  17.   }
  18.   else{
  19.     x=xs2
  20.   }
  21. }
  22. if (x>=T){
  23.   p=p+1
  24. }
  25. wynik=c(wynik,x)
  26. }
  27. p
  28. wynik
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement