lucaong / jQCloud

jQuery plugin for drawing neat word clouds that actually look like clouds
MIT License
646 stars 293 forks source link

different results for the same wordlist #49

Open willjohnson3 opened 10 years ago

willjohnson3 commented 10 years ago

I'm running into an issue where rendering the same wordlist is producing different clouds. Essentially hitting f5 in my browser will occasionally render different clouds including size+position+inclusion of terms in the cloud. from looking at the code this seems to be caused by the use of Math.random without a seed (i know math.random does not offer this option but there are lots of good alternatives)

my problem is that i'm using the cloud in an analytic application and the seeming 'randomness' of what gets displayed in the tagcloud is making users nervous about the backend.

willjohnson3 commented 10 years ago

fwiw: using the following library gave me nice repeatable results without having to modify jqcloud.

http://davidbau.com/archives/2010/01/30/random_seeds_coded_hints_and_quintillions.html

akastrin commented 7 years ago

@willjohnson3: I suppose you use Math.seedrandom() function. Where did you put it?