Category: Math

The devil made me do it.

Me: why(22.4367)
MATLAB: The devil made me do it.

Years ago, when I was taking my first programming course on MATLAB, I learned a cool function in MATLAB: why This tiny function basically gives you some random statements. Try typing “why” and enter. It gives you outputs like this:

Since it is a random sentence generator, you can also give a seed number to it (like why(100)) and...

More

Modulo of Multiplication of Big Numbers in C

Recently I had some difficulties to generate pseudo-random numbers in C by using Lehmer’s method. Lehmer random number generator is an easy-to-implement algorithm that provides random number stream. Basically you have a multiplier (a) and modulus (m) which you use in a basic arithmetic to get next number. Let we have the initial seed  $$s$$, than the following numbers can...

More