Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

add a call to allow specification of RNG function #35

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants

mthome commented Apr 4, 2014

I've added a cloud.random(f) call that allows one to supply an alternative random number generator function to the layout engine. If you supply a function returning a constant value, you get behavior like #14. A more interesting case to supply a seeded RNG so that you can get the visual effect of a random cloud but a repeatable layout by either seeding with a constant or a value computed simply from the tag field. The default behavior is to use Math.random() as before.
Example1:
cloud.random(function() { return 0.5; })
Example2:
var myrng = SeedRandom.rng("myseed");
cloud.random(function() { return myrng.random(); } )

@mthome mthome add a cloud.random(f) call to allow specification of constant, seeded…
…, or standard (default) random number generator for stable clouds
a750c4d

@jasondavies jasondavies added a commit that referenced this pull request Jun 22, 2015

@jasondavies jasondavies Release 1.1.0.
This includes a number of different updates:

* Finally, an API reference!
* New feature: cloud.random for overriding the internal RNG; fixes #1, #35, #45.
* Updates and example usage for Node.js; fixes #46.
* Add AMD support; fixes #32.
0ed9ac8

@cesine cesine referenced this pull request in cesine/d3-cloud Jun 25, 2015

Merged

Reproducible clouds #81

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment