summaryrefslogtreecommitdiff
path: root/2004/i
diff options
context:
space:
mode:
authorschodet2004-02-29 18:00:14 +0000
committerschodet2004-02-29 18:00:14 +0000
commit050c837d32b445c60e28ca57d15c879b0f47b19c (patch)
treea44c5736655db510818ff5497a4095f62dcbe3f0 /2004/i
parentd5d826d6dc8dce514e16e6ac27d59a7fa2e2a356 (diff)
Add: routines pour les nombres aléatoires.
Diffstat (limited to '2004/i')
-rw-r--r--2004/i/nono/src/utils/Makefile.defs4
-rw-r--r--2004/i/nono/src/utils/rand.cc44
-rw-r--r--2004/i/nono/src/utils/rand.h30
3 files changed, 78 insertions, 0 deletions
diff --git a/2004/i/nono/src/utils/Makefile.defs b/2004/i/nono/src/utils/Makefile.defs
new file mode 100644
index 0000000..34ca3dc
--- /dev/null
+++ b/2004/i/nono/src/utils/Makefile.defs
@@ -0,0 +1,4 @@
+LIBS += utils.a
+utils_a_SOURCES = rand.cc
+
+utils.a: ${utils_a_SOURCES:%.cc=utils.a(%.o)}
diff --git a/2004/i/nono/src/utils/rand.cc b/2004/i/nono/src/utils/rand.cc
new file mode 100644
index 0000000..623ddc1
--- /dev/null
+++ b/2004/i/nono/src/utils/rand.cc
@@ -0,0 +1,44 @@
+// rand.cc
+// nono - programme du robot 2004. {{{
+//
+// Copyright (C) 2004 Nicolas Schodet
+//
+// Robot APB Team/Efrei 2004.
+// Web: http://assos.efrei.fr/robot/
+// Email: robot AT efrei DOT fr
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// }}}
+#include "rand.h"
+
+#include <time.h>
+
+/// Classe d'initialisation du générateur de nombres aléatoires.
+class RandInit
+{
+ public:
+ /// Constructeur.
+ RandInit (void);
+};
+
+static RandInit randInit;
+
+/// Constructeur.
+RandInit::RandInit (void)
+{
+ srand (time (0));
+}
+
diff --git a/2004/i/nono/src/utils/rand.h b/2004/i/nono/src/utils/rand.h
new file mode 100644
index 0000000..0addb8d
--- /dev/null
+++ b/2004/i/nono/src/utils/rand.h
@@ -0,0 +1,30 @@
+#ifndef rand_h
+#define rand_h
+// rand.h
+// nono - programme du robot 2004. {{{
+//
+// Copyright (C) 2004 Nicolas Schodet
+//
+// Robot APB Team/Efrei 2004.
+// Web: http://assos.efrei.fr/robot/
+// Email: robot AT efrei DOT fr
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// }}}
+
+#include <stdlib.h>
+
+#endif // rand_h