This is the mail archive of the mailing list for the Cygwin project. See the Cygwin home page for more information.
Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: random_shuffle failure on B20.1?

"Phil Edwards" <> writes:
> I've been doing some work under B20.1/egcs-1.1.2 using
> -mno-cygwin, and getting errors when I try to use the
> standard algorithm random_shuffle() (which I have
> used before, so I know the STL code isn't completely
> full of cheese, etc).

Please look up the specs for random_shuffle -- it requires a
random access iterator (hint: use deque as opposed to list).

> The error messages, and an almost-minimal test case,
> were saved to bug.txt; the file is attached.
> When I used random_shuffle before, I had problems
> because the 48-bit generator would be used instead of
> the older generator; we had to call srand48() instead
> of srand() before random became truly random.  But
> at least it compiled then... is {,l,r}rand() not
> implemented on the LoseNT end, or is the wrong cpp
> macro being defined?

Here's a patch for Mingw ... please patch the stl_config.h file located
in the <install_root>/include/g++ directory with the following:

--- stl_config.h.~1	Fri Apr  9 17:19:19 1999
+++ stl_config.h	Fri Apr  9 17:20:38 1999
@@ -138,6 +138,10 @@
 #   define __STL_USE_NAMESPACES
 # endif
+# if defined(__GNUC__) && defined(__MINGW32__)
+#   define __STL_NO_DRAND48
+# endif
 # if defined(_MSC_VER)
 #   if _MSC_VER > 1000
 #     include <yvals.h>


Want to unsubscribe from this list?
Send a message to