msgid ""
msgstr ""
"Project-Id-Version: PSPP 0.3.1\n"
+"Report-Msgid-Bugs-To: pspp-dev@gnu.org\n"
"POT-Creation-Date: 2004-02-03 09:11+0800\n"
"PO-Revision-Date: 2004-01-23 13:04+0800\n"
"Last-Translator: John Darrington <john@darrington.wattle.id.au>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
-"Report-Msgid-Bugs-To: pspp-dev@gnu.org\n"
"Plural-Forms: nplurals=2; plural=(n!=1);\n"
#: src/crosstabs.q:255
set_nullline = 1;
set_more = 1;
set_prompt = xstrdup ("PSPP> ");
- set_seed = 2000000;
+ set_seed = NOT_LONG;
#if __DJGPP__ || __BORLANDC__
{
rng_create (void)
{
struct rng *rng;
- static time_t t;
+ static time_t t=0;
rng = xmalloc (sizeof *rng);
- if (t == 0)
- time (&t);
+ if (t == 0 || set_seed == NOT_LONG)
+ {
+ if (set_seed == NOT_LONG)
+ time (&t);
+ else
+ t = set_seed;
+ }
else
t++;
rng_seed (rng, &t, sizeof t);
unsigned long value;
rng_get_bytes (rng, &value, sizeof value);
- return value / ULONG_MAX;
+ return value / (double) ULONG_MAX;
}
/* Returns a random number from the distribution with mean 0 and
int set_scompression;
int set_screen;
long set_seed;
-int set_seed_used;
int set_testing_mode;
int set_undefined;
int set_viewlength;
bugs/alpha-freq.sh \
bugs/double-frequency.sh \
bugs/html-frequency.sh \
- bugs/crosstabs.sh
+ bugs/crosstabs.sh \
+ bugs/random.sh
noinst_PROGRAMS = gengarbage
--- /dev/null
+#!/bin/sh
+
+# This program tests for a bug which caused UNIFORM(x) to always return zero.
+
+
+TEMPDIR=/tmp/pspp-tst-$$
+
+here=`pwd`;
+
+# ensure that top_srcdir is absolute
+cd $top_srcdir; top_srcdir=`pwd`
+
+export STAT_CONFIG_PATH=$top_srcdir/config
+
+
+cleanup()
+{
+ rm -rf $TEMPDIR
+}
+
+
+fail()
+{
+ echo $activity
+ echo FAILED
+ cleanup;
+ exit 1;
+}
+
+
+no_result()
+{
+ echo $activity
+ echo NO RESULT;
+ cleanup;
+ exit 2;
+}
+
+pass()
+{
+ cleanup;
+ exit 0;
+}
+
+mkdir -p $TEMPDIR
+
+cd $TEMPDIR
+
+activity="create program"
+cat > $TEMPDIR/rnd.sps <<EOF
+set seed=10.
+input program.
++ loop #i = 1 to 20.
++ do repeat response=r1.
++ compute response = uniform(10).
++ end repeat.
++ end case.
++ end loop.
++ end file.
+end input program.
+
+list.
+EOF
+if [ $? -ne 0 ] ; then no_result ; fi
+
+$here/../src/pspp -o raw-ascii $TEMPDIR/rnd.sps
+if [ $? -ne 0 ] ; then no_result ; fi
+
+
+diff -b -B -w $TEMPDIR/pspp.list - << EOF
+ R1
+--------
+ 2.36
+ 3.13
+ 1.76
+ .15
+ 5.88
+ 8.74
+ 2.19
+ 6.53
+ 5.69
+ 6.77
+ 7.20
+ 4.01
+ .03
+ 4.67
+ 5.10
+ .44
+ 8.27
+ 6.81
+ 9.55
+ 8.74
+EOF
+if [ $? -ne 0 ] ; then fail ; fi
+
+pass;