[Bug libstdc++/13284] 126 g++ failures due to lrand48 not defined

bkoz at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Dec 4 18:44:00 GMT 2003


------- Additional Comments From bkoz at gcc dot gnu dot org  2003-12-04 18:44 -------

I think, on balance and after looking at this, that stl_algo.h should just be
using rand.


  /**
   *  @if maint
   *  Return a random number in the range [0, __n).  This function encapsulates
   *  whether we're using rand (part of the standard C library) or lrand48
   *  (not standard, but a much better choice whenever it's available).
   *
   *  XXX There is no corresponding encapsulation fn to seed the generator.
   *  @endif
  */
  template<typename _Distance>
    inline _Distance
    __random_number(_Distance __n)
    {
  #ifdef _GLIBCXX_HAVE_LRAND48
      return lrand48() % __n;
  #else
      return rand() % __n;
  #endif
    }

Ie, this should just be rand, the code collapsed, and the configuration
complexity should be removed.

-benjamin

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13284



More information about the Gcc-bugs mailing list