Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | "Chris M. Thomasson" <nospam@nospam.nospam> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: thread-safe random numbers... |
| Date | 2015-07-10 13:53 -0700 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <mnpbbs$67h$1@speranza.aioe.org> (permalink) |
| References | <mk61l9$ap4$1@speranza.aioe.org> <5b63a727-afb4-42c2-93d6-844989aa7e58@googlegroups.com> |
> "Rick C. Hodgin" wrote in message news:5b63a727-afb4-42c2-93d6-> > > 844989aa7e58@googlegroups.com... > > On Wednesday, May 27, 2015 at 11:22:27 PM UTC-4, Chris M. Thomasson > > wrote: > > I am trying to find the standard method for creating > > random numbers in a thread-safe manner in C. [...] > I would just wrap the function you use the call to retrieve the next > random number in a semaphore of some kind. That would give it fully > atomic access, first come, first served, and minimal delay because > of the speed in the random algorithm (assuming you're using the C > algorithm). Why not create an instance of PRNG on a per-thread basis? I want to try and avoid threads fighting over shared location(s) as much as possible. A semaphore would work fine, however, the overheads would be way too much for some of my applications Rick.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
thread-safe random numbers... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-05-27 20:22 -0700
Re: thread-safe random numbers... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-05-28 11:11 -0700
Re: thread-safe random numbers... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-05-28 11:19 -0700
Re: thread-safe random numbers... Rosario19 <Ros@invalid.invalid> - 2015-05-29 07:28 +0200
Re: thread-safe random numbers... James Kuyper <jameskuyper@verizon.net> - 2015-05-28 14:22 -0400
Re: thread-safe random numbers... Keith Thompson <kst-u@mib.org> - 2015-05-28 12:38 -0700
Re: thread-safe random numbers... James Kuyper <jameskuyper@verizon.net> - 2015-05-28 16:42 -0400
Re: thread-safe random numbers... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-05-28 13:57 -0700
Re: thread-safe random numbers... Nobody <nobody@nowhere.invalid> - 2015-05-29 22:42 +0100
Re: thread-safe random numbers... Tim Rentsch <txr@alumni.caltech.edu> - 2015-07-10 11:56 -0700
Re: thread-safe random numbers... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-07-10 14:03 -0700
Re: thread-safe random numbers... Tim Rentsch <txr@alumni.caltech.edu> - 2015-07-11 13:44 -0700
Re: thread-safe random numbers... "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-07-10 12:01 -0700
Re: thread-safe random numbers... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-07-10 13:53 -0700
Re: thread-safe random numbers... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-07-10 13:58 -0700
Re: thread-safe random numbers... "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-07-10 14:04 -0700
Re: thread-safe random numbers... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-07-10 14:23 -0700
Re: thread-safe random numbers... Keith Thompson <kst-u@mib.org> - 2015-07-10 17:12 -0700
Re: thread-safe random numbers... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-07-10 18:58 -0700
Re: thread-safe random numbers... Rosario19 <Ros@invalid.invalid> - 2015-07-11 11:13 +0200
csiph-web