I'm completely new to JQuery and I hope to get some help from SO folks.
This snippet basically generated a random numbers and filled a list along with index values
i.e. [0 10],[1 12],[2 30]... so on
function getRandomData() {
if (data.length > 0)
data = data.slice(1);
// do a random walk
while (data.length < totalPoints) {
var prev = data.length > 0 ? data[data.length - 1] : 50;
var y = prev + Math.random() * 10 - 5;
if (y < 0)
y = 0;
if (y > 100)
y = 100;
data.push(y);
}
// zip the generated y values with the x values
var res = [];
for (var i = 0; i < data.length; ++i)
res.push([i, data[i]])
return res;
}
Can any one out there help me out with the syntax to retrieve the elements inside data which is in turn present in the res collection.
i.e. i want to know the random number generated each time the function getRandomData
is called
I hope i made it clear Regards