Jump to content

BBO's random number generator


hrothgar

Recommended Posts

And that's what I got. In the two batches of 10K, I got 852 and 805 ties, so the total is 1652, very close to that.

 

Was bored (and wanted to convince myself that my brain hadn't turned completely to swiss cheese) so I threw together a new improved R script for HCP simulation

 

I generated 4000 simulations of 5000 deals, counted how many ties there were, and calculated the mean

 

The mean was 410.7493 which is also precisely 1644/4

 

 

sim_length = 5000

 

foo <- c(4,4,4,4,3,3,3,3,2,2,2,2,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

 

counter <- matrix(0, 2, sim_length)

 

counter_two <- matrix(0, 1, 4000)

 

for (j in 1:4000){

 

for (i in 1:sim_length){

 

bar <- sample(foo)

 

counter[1,i] <- sum(bar[1:26])

counter[2,i] <- sum(bar[27:52])

 

}

 

the_same <- ifelse(counter[1,] == counter[2,], 1, 0)

counter_two[j] <- sum(the_same)

 

}

 

mean(counter_two)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...