Groups | Search | Server Info | Login | Register


Groups > comp.lang.c > #396315

Re: srand(0)

From Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups comp.lang.c
Subject Re: srand(0)
Date 2026-01-08 22:46 -0800
Organization None to speak of
Message-ID <87tswvnuzx.fsf@example.invalid> (permalink)
References (2 earlier) <867bttph43.fsf@linuxsc.com> <87ikddgkc2.fsf@example.invalid> <10joipc$1jc43$1@dont-email.me> <87344fhghg.fsf@example.invalid> <10jq5u1$23nps$1@dont-email.me>

Show all headers | View raw


Michael Sanders <porkchop@invalid.foo> writes:
> On Thu, 08 Jan 2026 14:44:27 -0800, Keith Thompson wrote:
>> Michael Sanders <porkchop@invalid.foo> writes:
[...]
>>> So then clang would use:
>>>
>>> #ifdef __OpenBSD__
>>>     srand_deterministic(seed);
>>> #else
>>>     srand(seed);
>>> #endif
>>>
>>> But I don't know (yet) that gcc does as well under OpenBSD.
>> 
>> I don't know what you mean when you say that clang "would use"
>> that code.
>> 
>> I'm not aware that either clang or gcc uses random numbers
>> internally.  I don't know why they would.
>
> Well, I meant the macro itself is (I'm guessing) probably defined
> by clang since its the default compiler.

You mean the macro __OpenBSD__?  Yes, that and other similar macros
are predefined by the compiler, which is configured for each OS.
gcc on OpenBSD also predefines it.  (I don't know whether it's
predefined by the preprocessor directly or by some header that's
included implicitly.  That doesn't really matter.)  Compilers on
other platforms will not predefine __OpenBSD__.

But your original statement implied that clang would *use* that
particular piece of code, which didn't make much sense.  Were you
just asking about how the __OpenBSD__ macro is defined, without
reference to srand?

[...]

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-22 08:48 +0000
  Re: srand(0) James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-12-22 06:44 -0500
    Re: srand(0) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-22 13:18 +0100
      Re: srand(0) James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-12-22 12:13 -0500
        Re: srand(0) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-22 18:41 +0100
          Re: srand(0) Michael S <already5chosen@yahoo.com> - 2025-12-22 20:45 +0200
            Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-22 21:16 +0000
            Re: srand(0) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-22 22:19 +0100
            Re: srand(0) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-22 22:57 +0100
              Re: srand(0) Michael S <already5chosen@yahoo.com> - 2025-12-23 11:18 +0200
                Re: srand(0) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-23 10:54 +0100
                Re: srand(0) Michael S <already5chosen@yahoo.com> - 2025-12-23 13:50 +0200
                Re: srand(0) James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-12-23 18:29 -0500
                Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-23 16:30 -0800
            Re: srand(0) antispam@fricas.org (Waldek Hebisch) - 2025-12-23 17:54 +0000
              Re: srand(0) Michael S <already5chosen@yahoo.com> - 2025-12-24 00:08 +0200
                Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-24 02:02 +0000
                Re: srand(0) James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-12-23 23:43 -0500
                Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-24 05:34 +0000
                Re: srand(0) antispam@fricas.org (Waldek Hebisch) - 2025-12-24 09:00 +0000
                Re: srand(0) Michael S <already5chosen@yahoo.com> - 2025-12-24 12:12 +0200
                Article of Melissa O'Nail (Was: srand(0)) Michael S <already5chosen@yahoo.com> - 2025-12-28 02:44 +0200
                Re: Article of Melissa O'Nail antispam@fricas.org (Waldek Hebisch) - 2025-12-28 05:38 +0000
                Re: Article of Melissa O'Nail Michael S <already5chosen@yahoo.com> - 2025-12-28 12:35 +0200
                Re: Article of Melissa O'Nail Michael S <already5chosen@yahoo.com> - 2026-01-05 14:21 +0200
                Re: Article of Melissa O'Nail antispam@fricas.org (Waldek Hebisch) - 2026-01-07 10:51 +0000
                Re: Article of Melissa O'Nail Michael S <already5chosen@yahoo.com> - 2026-01-08 14:03 +0200
                Re: Article of Melissa O'Nail Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-01-08 09:40 -0800
                Re: srand(0) Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-01-08 09:26 -0800
                Re: srand(0) "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2025-12-24 13:48 -0800
                Re: srand(0) Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-01-07 08:41 -0800
                Re: srand(0) Michael S <already5chosen@yahoo.com> - 2026-01-08 01:06 +0200
                Re: srand(0) Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-02-03 05:26 -0800
                Re: srand(0) Michael S <already5chosen@yahoo.com> - 2026-02-03 16:37 +0200
                Re: srand(0) Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-02-17 23:47 -0800
                Re: srand(0) Tristan Wibberley <tristan.wibberley+netnews2@alumni.manchester.ac.uk> - 2026-02-18 11:21 +0000
                Re: srand(0) David Brown <david.brown@hesbynett.no> - 2026-02-19 10:01 +0100
                Re: srand(0) James Kuyper <jameskuyper@alumni.caltech.edu> - 2026-02-19 14:33 -0500
                Re: srand(0) David Brown <david.brown@hesbynett.no> - 2026-02-19 20:47 +0100
                Re: srand(0) James Kuyper <jameskuyper@alumni.caltech.edu> - 2026-02-20 16:01 -0500
                Re: srand(0) David Brown <david.brown@hesbynett.no> - 2026-02-21 11:09 +0100
                Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-02-19 14:39 -0800
                Re: srand(0) David Brown <david.brown@hesbynett.no> - 2026-02-20 09:16 +0100
                Re: srand(0) Paul <nospam@needed.invalid> - 2026-02-23 08:32 -0500
                Re: srand(0) David Brown <david.brown@hesbynett.no> - 2026-02-23 16:05 +0100
                Re: srand(0) Michael S <already5chosen@yahoo.com> - 2026-02-23 19:59 +0200
                Re: srand(0) David Brown <david.brown@hesbynett.no> - 2026-02-23 20:06 +0100
                Re: srand(0) Paul <nospam@needed.invalid> - 2026-02-23 15:24 -0500
                Re: srand(0) Axel Reichert <mail@axel-reichert.de> - 2026-02-24 07:08 +0100
                Re: srand(0) David Brown <david.brown@hesbynett.no> - 2026-02-24 10:24 +0100
                Re: srand(0) Axel Reichert <mail@axel-reichert.de> - 2026-02-26 19:13 +0100
              Re: srand(0) BGB <cr88192@gmail.com> - 2025-12-24 05:22 -0600
                Re: srand(0) BGB <cr88192@gmail.com> - 2025-12-24 23:09 -0600
                Re: srand(0) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-25 09:51 +0100
                Re: srand(0) BGB <cr88192@gmail.com> - 2025-12-25 04:24 -0600
              Re: srand(0) Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-01-07 07:50 -0800
            Re: srand(0) Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-01-07 07:46 -0800
              Re: srand(0) Michael S <already5chosen@yahoo.com> - 2026-01-07 18:14 +0200
          Re: srand(0) Kaz Kylheku <046-301-5902@kylheku.com> - 2025-12-22 19:16 +0000
            Re: srand(0) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-22 22:35 +0100
      Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-23 07:24 +0000
        Re: srand(0) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-23 09:59 +0100
          Re: srand(0) Michael Bäuerle <michael.baeuerle@stz-e.de> - 2025-12-23 11:09 +0100
            Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-23 14:49 +0000
          Re: srand(0) scott@slp53.sl.home (Scott Lurndal) - 2025-12-23 16:13 +0000
            Re: srand(0) richard@cogsci.ed.ac.uk (Richard Tobin) - 2025-12-23 19:05 +0000
        Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-23 02:16 -0800
          Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-23 14:47 +0000
        Re: srand(0) scott@slp53.sl.home (Scott Lurndal) - 2025-12-23 16:08 +0000
          Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-24 15:44 +0000
    Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-23 07:17 +0000
      Re: srand(0) David Brown <david.brown@hesbynett.no> - 2025-12-23 08:25 +0100
        Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-23 14:45 +0000
          Re: srand(0) David Brown <david.brown@hesbynett.no> - 2025-12-23 19:15 +0100
  Re: srand(0) John McCue <jmclnx@gmail.com.invalid> - 2025-12-23 00:39 +0000
    Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-23 02:17 +0000
      Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-23 14:55 +0000
        Re: srand(0) BGB <cr88192@gmail.com> - 2025-12-24 23:35 -0600
          Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-26 08:23 +0000
            Re: srand(0) BGB <cr88192@gmail.com> - 2025-12-26 14:48 -0600
              Re: srand(0) BGB <cr88192@gmail.com> - 2025-12-26 15:12 -0600
    Re: srand(0) Ike Naar <ike@sdf.org> - 2025-12-23 06:49 +0000
      Re: srand(0) John McCue <jmclnx@gmail.com.invalid> - 2025-12-23 20:37 +0000
        Re: srand(0) Ike Naar <ike@sdf.org> - 2025-12-24 15:22 +0000
    Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-23 07:25 +0000
      Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-24 06:16 +0000
        Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-24 15:21 +0000
          Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-24 19:00 +0000
            Re: srand(0) BGB <cr88192@gmail.com> - 2025-12-25 03:07 -0600
              Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-25 19:31 +0000
                Re: srand(0) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-25 21:14 +0100
                Re: srand(0) BGB <cr88192@gmail.com> - 2025-12-25 15:29 -0600
                Re: srand(0) Paul <nospam@needed.invalid> - 2025-12-25 23:25 -0500
                Re: srand(0) BGB <cr88192@gmail.com> - 2025-12-25 23:41 -0600
                Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-26 05:42 +0000
                Re: srand(0) Paul <nospam@needed.invalid> - 2025-12-26 01:52 -0500
                Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-26 07:56 +0000
                Re: srand(0) BGB <cr88192@gmail.com> - 2025-12-26 04:48 -0600
      Re: srand(0) Michael S <already5chosen@yahoo.com> - 2025-12-24 10:51 +0200
        Re: srand(0) "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2025-12-24 00:59 -0800
        Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-24 15:28 +0000
          Re: srand(0) Michael S <already5chosen@yahoo.com> - 2025-12-24 17:44 +0200
            Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-24 16:17 +0000
              Re: srand(0) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-24 17:53 +0100
                Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-24 17:27 +0000
                Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-24 17:33 +0000
                Re: srand(0) Michael S <already5chosen@yahoo.com> - 2025-12-24 20:16 +0200
                Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-25 02:01 +0000
                Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-25 03:17 +0000
                Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-26 08:13 +0000
                Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-25 04:30 +0000
                Re: srand(0) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-25 09:10 +0100
                Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-26 08:08 +0000
                Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-30 06:07 +0000
                Re: srand(0) scott@slp53.sl.home (Scott Lurndal) - 2025-12-30 18:42 +0000
                Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-31 02:01 +0000
                Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-31 03:10 +0000
                Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-31 03:28 +0000
                Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-31 09:37 +0000
                Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2026-01-01 07:32 +0000
                Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-01-01 19:02 +0000
                Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2026-01-01 19:20 +0000
                Re: srand(0) Michael S <already5chosen@yahoo.com> - 2026-01-01 21:53 +0200
                Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-01-01 23:50 +0000
                Re: srand(0) Michael S <already5chosen@yahoo.com> - 2026-01-02 14:32 +0200
                Re: srand(0) Michael S <already5chosen@yahoo.com> - 2026-01-02 16:18 +0200
                Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-01-02 20:52 +0000
                Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-01-02 20:46 +0000
                Re: srand(0) Mike Terry <news.dead.person.stones@darjeeling.plus.com> - 2026-01-03 04:08 +0000
                Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-01-03 04:39 +0000
                Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2026-01-03 14:24 +0000
                Re: srand(0) Michael S <already5chosen@yahoo.com> - 2026-01-03 20:38 +0200
                Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-30 19:37 -0800
                Re: srand(0) scott@slp53.sl.home (Scott Lurndal) - 2025-12-31 17:24 +0000
                Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-31 15:17 -0800
                Re: srand(0) Paul <nospam@needed.invalid> - 2025-12-31 12:30 -0500
                Re: srand(0) bart <bc@freeuk.com> - 2025-12-31 18:42 +0000
                Re: srand(0) Paul <nospam@needed.invalid> - 2025-12-31 15:07 -0500
                Re: srand(0) Michael S <already5chosen@yahoo.com> - 2025-12-31 22:18 +0200
                Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-31 20:55 +0000
                Re: srand(0) bart <bc@freeuk.com> - 2025-12-31 22:57 +0000
                Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-31 16:00 -0800
                Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-01-01 01:03 +0000
                Re: srand(0) bart <bc@freeuk.com> - 2026-01-01 14:05 +0000
                Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-01-01 19:03 +0000
                Re: srand(0) bart <bc@freeuk.com> - 2026-01-01 20:28 +0000
                Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-31 15:29 -0800
                Re: srand(0) highcrew <high.crew3868@fastmail.com> - 2026-01-01 00:31 +0100
                Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-31 16:05 -0800
                Re: srand(0) Michael S <already5chosen@yahoo.com> - 2025-12-31 15:29 +0200
                Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-31 20:52 +0000
                Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-31 15:14 -0800
                Re: srand(0) Geoff <geoff@invalid.invalid> - 2026-01-05 20:00 -0800
                Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-31 15:03 -0800
                Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-30 19:35 -0800
                Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-31 04:51 +0000
                Re: srand(0) Michael S <already5chosen@yahoo.com> - 2025-12-31 15:15 +0200
                Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-31 20:51 +0000
                Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-31 15:00 -0800
                Re: srand(0) Michael S <already5chosen@yahoo.com> - 2026-01-01 01:45 +0200
                Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-31 16:34 -0800
                Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2026-01-01 07:23 +0000
                Re: srand(0) Mike Terry <news.dead.person.stones@darjeeling.plus.com> - 2026-01-01 02:01 +0000
                Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-01-01 02:29 +0000
                Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-30 06:34 +0000
                Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-30 14:05 +0000
                Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-28 05:51 +0000
            Re: srand(0) scott@slp53.sl.home (Scott Lurndal) - 2025-12-24 17:08 +0000
    Re: srand(0) Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-01-07 07:39 -0800
      Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-01-07 13:54 -0800
        Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2026-01-08 15:34 +0000
          Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-01-08 14:44 -0800
            Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2026-01-09 06:06 +0000
              Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-01-08 22:46 -0800
                Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2026-01-09 22:38 +0000
                Re: srand(0) scott@slp53.sl.home (Scott Lurndal) - 2026-01-09 23:27 +0000
                Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-01-09 17:09 -0800
                Re: srand(0) Kaz Kylheku <046-301-5902@kylheku.com> - 2026-01-10 19:44 +0000
        Re: srand(0) Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-01-09 00:36 -0800
  Re: srand(0) Bonita Montero <Bonita.Montero@gmail.com> - 2025-12-23 11:04 +0100
  Re: srand(0) "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2025-12-23 21:44 -0800
    Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-24 15:41 +0000
      Re: srand(0) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-24 18:04 +0100
        Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-25 05:41 +0000
  Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2026-01-08 02:57 +0000

csiph-web