functions

S

sonic0568

what's the difference between rand() & random() ?

thanx!
i am the new comer here,maybe i break some rules that i don't kown
before;please forgive me...
 
R

Richard Heathfield

sonic0568 said:
what's the difference between rand() & random() ?

rand() is a standard C library function, prototyped in the <stdlib.h>
header. It produces, on successive calls, a series of pseudo-random numbers
in the range 0 to RAND_MAX. You can set the starting point in that series
by passing it to srand(), which is also a standard library function.

random() is whatever you want it to be, subject only to your skill and
imagination. Implementations are free to provide extra functions as an
extension if they wish, and they have to call them something, so you might
want to have a look at your documentation to see whether random() is
mentioned there. If it is, bear in mind that some other implementation
might implement that function with different functionality, or not
implement it at all.
 
A

Anand

sonic0568 said:
what's the difference between rand() & random() ?

thanx!
i am the new comer here,maybe i break some rules that i don't kown
before;please forgive me...
random() is a non-standard function, So you should see the documentation
of your compiler.
<OT>
My compiler has the following doc.
| The random() and srandom() functions have (almost) the same
| calling sequence and initialization properties as rand() and
| srand() (see rand(3C)). The difference is that rand(3C) pro-
| duces a much less random sequence-in fact, the low dozen
| bits generated by rand go through a cyclic pattern. All the
| bits generated by random() are usable.
</OT>
For more details about rand() and generating a random number, see the FAQ.
 
S

sonic0568

and more...richard heathfield...i respect u very much!i'm reading ur book
these days...it's very helpful to me!

at the end,if my english has some problems,please let me kown,because my
mother tongue is not english..

thank u veeeeerrrry much~~
 
F

Flash Gordon

sonic0568 said:
and more...richard heathfield...i respect u very much!i'm reading ur book
these days...it's very helpful to me!

Please don't use contractions like "u" for you and "ur" for "your". It
makes it *much* harder to read your posts.
at the end,if my english has some problems,please let me kown,because my
mother tongue is not english..

Poor English due to it not being your native language is not a problem.
Using contractions like "u" is a problem.

Also, please provide context when replying to a post. See
http://cfaj.freeshell.org/google/
 
J

Jordan Abel

Poor English due to it not being your native language is not a problem.
Using contractions like "u" is a problem.

At least, until it becomes standard english it is. Expect this in a
couple centuries at most, less if you stop fighting it [but it is
inevitable]
 
F

Flash Gordon

Jordan said:
Poor English due to it not being your native language is not a problem.
Using contractions like "u" is a problem.

At least, until it becomes standard english it is. Expect this in a
couple centuries at most, less if you stop fighting it [but it is
inevitable]

1) It is not inevitable that it will become standard English.
2) I was stating the plain and simple truth when I said it is a problem.
It takes me noticeably more effort and time to read a post using
those contractions, and others have said the same in the past so it
is not just me.
 
R

Richard Tobin

Poor English due to it not being your native language is not a problem.
Using contractions like "u" is a problem.
[/QUOTE]
At least, until it becomes standard english it is. Expect this in a
couple centuries at most, less if you stop fighting it [but it is
inevitable]

Do you really think that most people will still be typing text in 200
years time? I think it's quite likely that most people will not need
to be able to read or write long before that.

-- Richard
 
S

sonic0568

i'll remember what you said;thank you ^ ^

by the way,the reason that i write that way because i'm a prince fan...he is
a ture genius...
 
I

Ian Malone

Richard said:
Poor English due to it not being your native language is not a problem.
Using contractions like "u" is a problem.

At least, until it becomes standard english it is. Expect this in a
couple centuries at most, less if you stop fighting it [but it is
inevitable]


Do you really think that most people will still be typing text in 200
years time? I think it's quite likely that most people will not need
to be able to read or write long before that.
[/QUOTE]

Or think. Actually, that one seems to have happened already.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top