the lost logbook

Utkarsh's mind.random() on Programming, India and Startups

Archive for the ‘Technology’ Category

Yay SSD!

leave a comment

Just upgraded my MacBook Pro 2011 (early) from a 500GB Toshbia HDD to Crucial 256GB SSD! And I will let the numbers do the talking!

Comparison of 500GB HDD vs 256GB SDD on a MacBook Pro 2011.


1. Performance stats for HDD (which comes with MacBook pro 2011):


2. Performance stats for SSD (Crucial):

Written by Utkarsh

November 22nd, 2012 at 2:15 am

Posted in Technology

Jiddu Krishnamurti

one comment

This guy is amazing, I understand him better as I grow up.

Written by Utkarsh

May 12th, 2012 at 4:36 am

Posted in Technology

Thank you Mr. Jobs

leave a comment

Thank you.

We aspire to be like you, but Steve Jobs will always be known as “The crazy one” and “The insanely awesome” visionary!

Your job is done, sleep well :)

And……a small gift for you:

Written by Utkarsh

October 6th, 2011 at 12:24 am

Posted in Technology

Tagged with ,

next() in Java from The art of computer programming

leave a comment

xkcd: Random NumberI have always used Random’s nextInt() or nextLong(). So was curious on how “random” is it actually? Then I found this protected method next().

protected int next(int bits)


Implementation of via Google code:

    protected int next(int bits) {
        long oldseed, nextseed;
        AtomicLong seed = this.seed;
        do {
            oldseed = seed.get();
            nextseed = (oldseed * multiplier + addend) & mask;
        } while (!seed.compareAndSet(oldseed, nextseed));
        return (int)(nextseed >>> (48 - bits));

The general contract of next is that it returns an int value and if the argument bits is between 1 and 32 (inclusive), then that many low-order bits of the returned value will be (approximately) independently chosen bit values, each of which is (approximately) equally likely to be 0 or 1. The method next is implemented by class Random by atomically updating the seed to

(seed * 0x5DEECE66DL + 0xBL) & ((1L << 48) - 1)

and returning

(int)(seed >>> (48 - bits))

This is a linear congruential pseudorandom number generator, as defined by D. H. Lehmer and described by Donald E. Knuth in The Art of Computer Programming, Volume 3: Seminumerical Algorithms, section 3.2.1.


EDIT: Something even more interesting: Why this code is giving strange result? So Random?

Link to JavaDocs for Random.

Written by Utkarsh

August 1st, 2011 at 11:47 pm

Posted in Technology

My emacs setup for python dev


Just configured aquamacs and it’s awesome! Simple and quick. Will put up my .emacs and other details soon on github here.

Stuff I am using are:

1. ECB – emacs code browser
2. emacs-for-python which includes all the goodies you need for python development!
3. Solarized dark theme, whose emacs port is here.

My fav feature? It’s M-x artist-mode , see a screencast here

(HOW-TO: Use mouse middle button to get options, COMMAND+click on a mac. Exit using M-x artist-mode-off)

Click to see full image

If you are using Aquamacs, I recommend you not to use ~/.emacs but directly edit the file which it loads, its located here: ~/Library/Preferences/Aquamacs Emacs/Preferences.el

The ultimate emacs course – An awesome 2hr video lecture for emacs!

Written by Utkarsh

June 13th, 2011 at 9:46 pm

Posted in Technology

Page optimized by WP Minify WordPress Plugin