<%
var data1 = [];
var data2 = [];
totalPoints = 50;
var chartOptions = require("../config/chart-options.json");
function getRandomData() {

    if (data1.length > 0)
        data1 = data1.slice(1);

    if (data2.length > 0)
        data2 = data2.slice(1);

    while (data1.length < totalPoints) {
        for (var i = 0; i <= 100; ++i) {
            var x1 = Math.random();
            var x2 = Math.random();
            var x = x1 + i * (Math.abs(x2 - x1)) / 100;
            data1.push([i,500 + 100* Math.sin(x * Math.sin(x))]);
        }
    }

    while (data2.length < totalPoints) {
        for (var i = 0; i <= 100; ++i) {
            var x1 = Math.random();
            var x2 = Math.random();
            var x = x1 + i * (Math.abs(x2 - x1)) / 100;
            data2.push([i, Math.cos(x)]);
        }
    }

    chartOptions["xaxis"]["autoscaleMargin"] = 0;
    return [
        {"series1":{label: "sin(x sin(x))", data: data1} /*, "series2":{label: "cos(x cos(x))", data: data2 }*/},chartOptions
    ];

}
print(getRandomData());

%>
