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.
return the tester object if another framework wants to use it.
__index__ and __newindex__ can leak a tensor if it reports a lua error. This change only fixes leaks that occur during the tests.
Merge pull request #15 from timharley/master

Stop __index__ and __newindex__ leaking a tensor during torch.test()
Run torch tests by name, or by index.
Merge pull request #16 from timharley/master

Run torch tests by name, or by index.
Unnecessarily static.
Make luaT_classmodulename thread safe.
Thread local callback and state for THError. Copied from github:koraykv/torch