Commit 512039bb authored by Luc Remambot's avatar Luc Remambot

Seeded random generator (issue: created for every app)


Former-commit-id: 2f800631f3d99d67a90c32d624347e91b9626369
parent c3ae63c8
......@@ -8,6 +8,14 @@
// http://opensource.org/licenses/BSD-3-Clause
// See included LICENSE.txt file
// New seeded Math.random function
Math.seed = function(s) {
Math.random = function() {
s = Math.sin(s) * 10000; return s - Math.floor(s);
}
};
var SAGE2_App = Class.extend( {
construct: function() {
this.div = null;
......@@ -40,6 +48,8 @@ var SAGE2_App = Class.extend( {
this.startDate = date;
this.prevDate = date;
this.frame = 0;
// Seed the number generator based on current time
Math.seed(date.getTime());
},
preDraw: function(date) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment