Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #125926

Re: srand

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c
Subject Re: srand
Date 2018-01-29 18:27 +1300
Message-ID <fd7plmFnvamU2@mid.individual.net> (permalink)
References <5a6eaddd$0$726$14726298@news.sunsite.dk>

Show all headers | View raw


On 01/29/2018 06:15 PM, G B wrote:
> Is there any significant difference between:
> 
> srand((unsigned) time(&t));
> 
> and
> 
> srand((int) time(null));

Well given "null" isn't defined, yes!

A less flippant answer is no, time(NULL) will return the same as 
time(&t).  I don't see the point of the casts (or why they are 
different), you may as well just write

srand(time(NULL));

--
Ian.

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


Thread

srand G B <gb@gb.com> - 2018-01-29 05:15 +0000
  Re: srand Ian Collins <ian-news@hotmail.com> - 2018-01-29 18:27 +1300
  Re: srand Keith Thompson <kst-u@mib.org> - 2018-01-28 23:09 -0800
    Re: srand Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-01-29 11:32 +0000
  Re: srand Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2018-01-29 08:46 -0700
  Re: srand Real Troll <Real.Troll@Trolls.com> - 2018-01-29 17:59 -0400
    Re: srand bartc <bc@freeuk.com> - 2018-01-29 22:07 +0000
    Re: srand Jorgen Grahn <grahn+nntp@snipabacken.se> - 2018-02-05 12:54 +0000

csiph-web