javascript - How can I generate random numbers for demo charts that roughly trend up and to the right? -
javascript - How can I generate random numbers for demo charts that roughly trend up and to the right? -
i need generate random numbers several charts go , right.
i'm using javascript charting engine require numbers in json, can handle conversion if have easy way outside of javascript.
here's simple randomnumber generator in javascript:
function randomnumber(minimum, maximum){ homecoming math.round( math.random() * (maximum - minimum) + minimum); } console.log(randomnumber(0,100));
the above work if min
, max
grew on time. can point me in right direction?
here's jsfiddle seek out various solutions, including handy chart: http://jsfiddle.net/9ox4wjrf/
here's rough illustration of sorts of charts need build generated data:
something may work:
var = 0.05; var b = 10; //play these values liking var y; //loop here 0 whatever y = * x^2 + b * x * math.random(); //or using randommumber function: y = * x^2 + randommumber(- b * x / 2, b * x / 2);
this way noise gets bigger when farther right
javascript json math random
Comments
Post a Comment