jwatte / node-mersenne

Node.js port of the Mersenne Twister random number generator
http://www.enchantedage.com/node-mersenne
BSD 3-Clause "New" or "Revised" License
12 stars 2 forks source link

Fixed internal state for serialization #1

Open FugueNation opened 12 years ago

FugueNation commented 12 years ago

I needed to store and send mersenne twister objects so I encapsulated the state so it can be serialized to JSON, and unserialized back from the exported state

jwatte commented 12 years ago

Thanks for the suggestion! The comments got screwed up by a global search/replace, though -- do you think you could fix and re-patch?

Sincerely,

jw

Americans might object: there is no way we would sacrifice our living standards for the benefit of people in the rest of the world. Nevertheless, whether we get there willingly or not, we shall soon have lower consumption rates, because our present rates are unsustainable.

On Mon, Dec 12, 2011 at 9:14 PM, FugueNation < reply@reply.github.com

wrote:

I needed to store and send mersenne twister objects so I encapsulated the state so it can be serialized to JSON, and unserialized back from the exported state

You can merge this Pull Request by running:

git pull https://github.com/FugueNation/node-mersenne master

Or you can view, comment on it, or merge it online at:

https://github.com/jwatte/node-mersenne/pull/1

-- Commit Summary --

  • encapsulated internal state so the MT object can be serialized and unserialized

-- File Changes --

M lib/mersenne.js (106)

-- Patch Links --

https://github.com/jwatte/node-mersenne/pull/1.patch https://github.com/jwatte/node-mersenne/pull/1.diff


Reply to this email directly or view it on GitHub: https://github.com/jwatte/node-mersenne/pull/1

jwatte commented 12 years ago

Actually, it would be great if you didn't break the API to rand(), where it expects a value, too.

Sincerely,

jw

Americans might object: there is no way we would sacrifice our living standards for the benefit of people in the rest of the world. Nevertheless, whether we get there willingly or not, we shall soon have lower consumption rates, because our present rates are unsustainable.

On Mon, Dec 12, 2011 at 9:14 PM, FugueNation < reply@reply.github.com

wrote:

I needed to store and send mersenne twister objects so I encapsulated the state so it can be serialized to JSON, and unserialized back from the exported state

You can merge this Pull Request by running:

git pull https://github.com/FugueNation/node-mersenne master

Or you can view, comment on it, or merge it online at:

https://github.com/jwatte/node-mersenne/pull/1

-- Commit Summary --

  • encapsulated internal state so the MT object can be serialized and unserialized

-- File Changes --

M lib/mersenne.js (106)

-- Patch Links --

https://github.com/jwatte/node-mersenne/pull/1.patch https://github.com/jwatte/node-mersenne/pull/1.diff


Reply to this email directly or view it on GitHub: https://github.com/jwatte/node-mersenne/pull/1

FugueNation commented 12 years ago

Thanks for the feedback! Fixed the API and comments

Best regards Robert