Refactored TH to not use global state for random number generation.

* Style / naming needs work.
* Breaks other layers within torch
Starting point for wrapping the mersenne state in a Lua object.
Miraculously bulds. Very unhappy when you try to run it.
qth runs, can call random methods if you explicitly pass a generator.
Create a generator in the lua torch scope.
Torch tests now pass! Allow all random functions to use the default generator if one isn't supplied when calling the function.
Rename mersenne_state to THGenerator.
Heinous bug.
Fix build warnings.
Indentation, whitespace, comments.
Reorder arguments to Tensor functions.
Whitespace. Duplicate #define.
Unnecessarily static.
Make luaT_classmodulename thread safe.
Thread local callback and state for THError. Copied from github:koraykv/torch
Merge pull request #17 from soumith/master

moving lots of tests from testme into main repo
Merge pull request #13 from timharley/thgenerator

Make random number generator state a TH type
Merge pull request #18 from timharley/thread_safety

Make luaT_classmodulename, THError & THArgCheck threadsafe
Merge https://github.com/torch/torch7