Ben Chuanlong Du's Blog

And let it direct your passion with reason.

How Many Empty Boxes?

If we randomly put \(n(\ge1)\) balls into \(m(\ge1)\) boxes, what is the expectation of the number of empty boxes?

See my neat answer here.

Define Operator in R

One thing I do not like R is that operations on String in R are not as convenient as in other programming langauges such as Java, Python and Ruby. In these 3 programming languages, you can simply use + to concatenate strings while in R you have to use the function …

Abuse of Vector in R

R is a language that is friendly to vector operation, so vector is an important data structure in R. A single data (of basic types, e.g., numeric or character) is essentially a vector of length 1. A matrix or an array in R is essentially a vector. R make …

Tips for VB/VB.net

About String Functions

  1. The uniform random variables generated by VB is pretty good. At least it's acceptable according to the test in R.

  2. String functions that return a string can be used with a dollar sign at the end, which is a faster version of the corresponding function.

  3. The function …