fork(1) download
  1. x_inf=670000
  2. x_sup=672000
  3. y_inf=9886000
  4. y_sup=9888000
  5. puntos_a_generar=5000
  6. diametro=x_sup-x_inf
  7. radio=diametro/2
  8. origen_x=x_inf+radio
  9. origen_y=y_inf+radio
  10.  
  11. datos=matrix(data=NA,nrow=0,ncol=3,byrow=FALSE,dimnames=NULL)
  12. datos=as.data.frame(datos)
  13. colnames(datos)=c("x","y","evento")
  14.  
  15. n = 0
  16. while(n < puntos_a_generar) {
  17. x_ale=(x_inf+((seq(0,1,length=100)[sample(1:100,1)])*diametro))
  18. y_ale=(y_inf+((seq(0,1,length=100)[sample(1:100,1)])*diametro))
  19. if(sqrt((x_ale-origen_x)^2+(y_ale-origen_y)^2)<radio)
  20. {
  21. nuevafila=data.frame(x=c(x_ale),y=c(y_ale),evento=NA)
  22. datos=rbind(datos,nuevafila)
  23. n=length(datos$x)
  24. }
  25. }
  26. write.csv(datos,'datos.cvs')
Success #stdin #stdout 2.54s 180544KB
stdin
Standard input is empty
stdout
Standard output is empty