## simulate randomly scattered pts in a diamond ## with vertices at (-1,0), (0,1), (1,0), (0,-1). z = matrix(0,ncol=2,nrow=1200) j=1 for(i in c(1:1200)){ x = runif(1)*2-1 y = runif(1)*2-1 if(abs(x)+abs(y) < 1){ z[j,] = c(x,y) j = j+1 } } j ## check that j > 500, so that you have kept at least 500 pts z2 = z[1:500,] plot(c(-1,0,1,0,-1),c(0,1,0,-1,0),type="n",xlab="",ylab="") ## sets axes points(z2,pch=".") ## MAKE TEAMS: name1 = c("a","b","c","d","e","f","g","h","i","j","k","l","m","n") x = c("ChrisB", "SethB", "CoreyC", "AvinashC", "DavidC", "JeffC", "JesseC", "AraD", "AmandaD", "MichaelD", "JasonG", "LiniG", "CoreyI","RafalJ", "RyanK", "HoL", "LongL", "JamesL", "AnnaL", "ZiqiM", "ErikM", "BenjaminN", "DaiN", "WooO", "ClaudiaP", "SamanthaS", "JiweiS", "SarahW", "BrianY") n = length(x) teams = function(){ y = x[sample(n)] for(i in 1:13){ cat("\n", "team", name1[i], y[(2*i-1):(2*i)]) } i = 14 cat("\n", "team", name1[i], y[(2*i-1):(2*i+1)]) } teams() team a AraD SethB team b AnnaL AmandaD team c LiniG ErikM team d LongL CoreyC team e BenjaminN JamesL team f MichaelD ChrisB team g RafalJ JesseC team h DaiN DavidC team i JiweiS AvinashC team j SamanthaS ZiqiM team k WooO CoreyI team l RyanK JasonG team m BrianY HoL team n SarahW JeffC ClaudiaP