summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/runmath.in
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/utils/asymptote/runmath.in')
-rw-r--r--Build/source/utils/asymptote/runmath.in16
1 files changed, 13 insertions, 3 deletions
diff --git a/Build/source/utils/asymptote/runmath.in b/Build/source/utils/asymptote/runmath.in
index d8f473a8433..2c4b0ef733d 100644
--- a/Build/source/utils/asymptote/runmath.in
+++ b/Build/source/utils/asymptote/runmath.in
@@ -56,6 +56,16 @@ inline Int sgn(double x)
return (x > 0.0 ? 1 : (x < 0.0 ? -1 : 0));
}
+static bool initializeRandom=true;
+
+void Srand(Int seed)
+{
+ initializeRandom=false;
+ const int n=256;
+ static char state[n];
+ initstate(intcast(seed),state,n);
+}
+
// Autogenerated routines:
@@ -89,14 +99,14 @@ Int sgn(real x)
Int rand()
{
+ if(initializeRandom)
+ Srand(1);
return random();
}
void srand(Int seed)
{
- const int n=256;
- static char state[n];
- initstate(intcast(seed),state,n);
+ Srand(seed);
}
// a random number uniformly distributed in the interval [0,1]