Home > HTML5 > Seedable random number generator for javascript

Seedable random number generator for javascript

So, the math function of javascript has a random number generator. It’s just that, if you’re used to a richer framework that has features like, oh nextInt() or nextFloat(), well, you’re out of luck. Or, you could harvest code from stackoverflow and use that.

🙂

I’ve borrowed that code, with a link to the original post out here. I plan on using this for a content generator system I have in mind to augment the tabletop game. Maybe you’ll find it useful too.

usage:

var rng = new RNG(20);
var randomResult = rng.nextRange(10,50);
Advertisements
Categories: HTML5
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: