468,463 Members | 1,988 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,463 developers. It's quick & easy.

Positive random number

Hi,

Can someone give the standard function which can create positive
integer value in C?

Thanks,
Deepak
Dec 18 '07
63 4928
Tim Prince wrote:
Dik T. Winter wrote:
>In article <fk**********@aioe.orgPhilip Potter <pg*@doc.ic.ac.ukwrites:
> Johannes Bauer wrote:
...
> Which fits your analogy nicely, as people in Great Britain drive on the
left side of the road and people in the US on the right side. So there
is obviously no dogmatic "correct way", but you have to ask: where
should I drive? In which environment is it *useful*? I will drive on the
left/right side because I an $WHEREEVER.

And everywhere I have been, 0 is nonpositive.

Apparently you have never been in France, French speaking Belgium or
French speaking Switzerland (and probably quite a few other places with
strong influence from French mathematics).
Not to mention the number of cases where machine instructions follow
your plan. The first machine I learned on, 30 years ago, designed in
USA, had 2's complement integer and float, and considered 0 as positive.
How do you know? Most machine instruction sets don't need any definition
of "positive". If you're defining "positive" to mean "sign bit clear"
then I could see where you were coming from, but there's no benefit to
doing this.
Dec 20 '07 #51
Richard Harter wrote:
>
On Thu, 20 Dec 2007 01:14:12 +0100, Johannes Bauer
<df***********@gmx.dewrote:
pete schrieb:
Johannes Bauer wrote:

Reminds me of all these stupid
US Americans who believe Europe is a
country and who become angry when you tell them that
Mexico is a part of America.

If you don't have a problem referring to
Los Estados Unidos Mexicanos as just "Mexico",
then you shouldn't have too much of a problem referring to
The United States Of America as just "America".
America is a continent.

Well, yes and no. Some people classify North America and South
America as a single continent.
It makes sense for the Afroeurasians and the Eurasians
to classify it that way, but not for the Europeans.

--
pete
Dec 20 '07 #52
Cross posted and Followup To: alt.religion.kibology
where I think there's some possibility that this may be on topic.

pete wrote:
>
Richard Harter wrote:

On Thu, 20 Dec 2007 01:14:12 +0100, Johannes Bauer
<df***********@gmx.dewrote:
>pete schrieb:
>Johannes Bauer wrote:
>>
>>Reminds me of all these stupid
>>US Americans who believe Europe is a
>>country and who become angry when you tell them that
>>Mexico is a part of America.
>>
>If you don't have a problem referring to
>Los Estados Unidos Mexicanos as just "Mexico",
>then you shouldn't have too much of a problem referring to
>The United States Of America as just "America".
>
>America is a continent.
Well, yes and no. Some people classify North America and South
America as a single continent.

It makes sense for the Afroeurasians and the Eurasians
to classify it that way, but not for the Europeans.
--
pete
Dec 20 '07 #53
On Thu, 20 Dec 2007 11:40:53 -0500, pete <pf*****@mindspring.comwrote:
>Cross posted and Followup To: alt.religion.kibology
where I think there's some possibility that this may be on topic.
Oh, ever so much of a possibility!
>pete wrote:
>Richard Harter wrote:
Johannes Bauer <df***********@gmx.dewrote:
pete schrieb:
If you don't have a problem referring to
Los Estados Unidos Mexicanos as just "Mexico",
then you shouldn't have too much of a problem referring to
The United States Of America as just "America".

America is a continent.

Well, yes and no. Some people classify North America and South
America as a single continent.

It makes sense for the Afroeurasians and the Eurasians
to classify it that way, but not for the Europeans.
And the Austrians, of course, are being distracted by poisonous nanomegafauna.

Dave "reunite gondwanaland!" DeLaney
--
\/David DeLaney posting from db*@vic.com "It's not the pot that grows the flower
It's not the clock that slows the hour The definition's plain for anyone to see
Love is all it takes to make a family" - R&P. VISUALIZE HAPPYNET VRbeable<BLINK>
http://www.vic.com/~dbd/ - net.legends FAQ & Magic / I WUV you in all CAPS! --K.
Dec 20 '07 #54
James Kuyper wrote:
Richard Bos wrote:
...
>The USA will just have to get used to being part of a greater
world.

Actually, no it doesn't. The USA is large enough and powerful
enough to get away with considering itself as separate from the
rest of the world, and that is precisely how most USA citizens
feel about it. I'm not advocating this, just pointing it out.
Your point is somewhat nebulous. The US is unable to handle a
minority group in a minority set of Islamic countries. It is
considerably smaller, and/or less populous and/or less well
educated than many other countries, such as Russia, Canada, China,
India, Brazil (Brazil may not be accurate) just to name a few.

I suspect the US would be well advised to study the evolution of
British structure since 1945. That would minimize language
difficulties during the study.

--
Merry Christmas, Happy Hanukah, Happy New Year
Joyeux Noel, Bonne Annee.
Chuck F (cbfalconer at maineline dot net)
<http://cbfalconer.home.att.net>

--
Posted via a free Usenet account from http://www.teranews.com

Dec 20 '07 #55


CBFalconer wrote:
James Kuyper wrote:
Richard Bos wrote:
...
The USA will just have to get used to being part of a greater
world.
Actually, no it doesn't. The USA is large enough and powerful
enough to get away with considering itself as separate from the
rest of the world, and that is precisely how most USA citizens
feel about it. I'm not advocating this, just pointing it out.

Your point is somewhat nebulous. The US is unable to handle a
minority group in a minority set of Islamic countries. It is
considerably smaller, and/or less populous and/or less well
educated than many other countries, such as Russia, Canada, China,
India, Brazil (Brazil may not be accurate) just to name a few.
I didn't say it was large or powerful enough to conquer or control any
significant portion of the rest of the world. I only said that it was
large and powerful enough to get away with a superiority complex. As
far as "less educated" is concerned, that makes holding on to a
superiority complex easier, not harder.
Dec 20 '07 #56
"CBFalconer" <cb********@yahoo.comwrote in message
>
There is an appreciable portion of USAnians who consider that a
passport is needed to visit New Mexico. I am pleased to hear that
all Europeans are well educated and completely knowledgeable. That
should avoid many arguments.
The US has stupid rich people. That's something you just don't find in
Europe.

Probably a reflection on the strength of the US economy. A stupid European
rapidly becomes poor, whilst in America it is a bit easier to hang onto your
money.

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm

Dec 20 '07 #57
Malcolm McLean wrote:
"CBFalconer" <cb********@yahoo.comwrote in message
>>
There is an appreciable portion of USAnians who consider that a
passport is needed to visit New Mexico. I am pleased to hear that
all Europeans are well educated and completely knowledgeable. That
should avoid many arguments.
The US has stupid rich people. That's something you just don't find in
Europe.

Probably a reflection on the strength of the US economy. A stupid
European rapidly becomes poor, whilst in America it is a bit easier to
hang onto your money.
Not stupid, just uninformed.

Dec 20 '07 #58
Johannes Bauer wrote:
[ snip ]
>
I have met *dozens* of such people while spending one year abroad. And,
do not misunderstand me here please, I do not at all think all US
Americans are stupid. I think all of them, who think that Mexico doesn't
belong to the continent America are stupid. And, as I said: I've met
plenty of those.

Greetings,
Johannes
I'll probably regret this but..

America is not a continent. The two continents over here are North
America and South America.

In 1776 we declared "The United States of America" independent of the
British Crown. The Brits didn't like this very much and fought us to
their defeat in 1781 at Yorktown and finally 1815 at New Orleans.

Citizens of the "United States of America" began referring to themselves
as "American" at about this time. Canada was there and those people
called themselves "Canadian". Mexico had been around for some time and
they described themselves "Mexican".

Everybody knew then and knows now who the "Americans" are.

Pinheads suggesting that Peruvians are Americans too are not nearly as
smart as they think they are.

--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Dec 21 '07 #59
James Kuyper wrote:

<snip>
Most of the world (or at least the part that bothers to think about
this) thinks it's pretty arrogant of us to appropriate a name that
describes two continents, and insist that it be used exclusively to
describe us.
Ironically one group that *does* call the USA as "America" is it's main
current enemy.
:-)

Dec 21 '07 #60
Joe Wright wrote:
>
.... snip ...
>
I'll probably regret this but..

America is not a continent. The two continents over here are North
America and South America.
Connected by a peculiar strip called 'Central America'.
In 1776 we declared "The United States of America" independent of the
British Crown. The Brits didn't like this very much and fought us to
their defeat in 1781 at Yorktown and finally 1815 at New Orleans.

Citizens of the "United States of America" began referring to
themselves as "American" at about this time. Canada was there and
those people called themselves "Canadian". Mexico had been around for
some time and they described themselves "Mexican".

Everybody knew then and knows now who the "Americans" are.

Pinheads suggesting that Peruvians are Americans too are not nearly
as smart as they think they are.
True enough, but not nearly as much fun as poking at people
committing any form of usage. Now discuss the 'USAnian' usage.
:-)

BTW, I suspect that most Peruvians, Mexicans, and Canadians, are
actually content to be labeled as Peruvian, Mexican, or Canadian
(as required).

--
Merry Christmas, Happy Hanukah, Happy New Year
Joyeux Noel, Bonne Annee.
Chuck F (cbfalconer at maineline dot net)
<http://cbfalconer.home.att.net>

--
Posted via a free Usenet account from http://www.teranews.com

Dec 21 '07 #61
Why not make it logic and balanced for everyone -www.usanian.com.
History is history, - change doesn't hurt.

Reason

Dec 28 '07 #62
gu******@gmail.com wrote:
>
Why not make it logic and balanced for everyone -www.usanian.com.
History is history, - change doesn't hurt.
Completely meaningless without quotes. See my sig. below.

--
If you want to post a followup via groups.google.com, ensure
you quote enough for the article to make sense. Google is only
an interface to Usenet; it's not Usenet itself. Don't assume
your readers can, or ever will, see any previous articles.
More details at: <http://cfaj.freeshell.org/google/>

--
Posted via a free Usenet account from http://www.teranews.com

Dec 28 '07 #63
Johannes Bauer wrote:
They are not obscure. Consider the work of Peano
(http://en.wikipedia.org/wiki/Giuseppe_Peano) which in his older works
state that the positive Integers start at 1, while at a later release
(Peano.G.: Formulaire de mathématiques 5 Bde. Turin, Bocca 1895-1908) he
states they start at zero.

It is *not* something that "almost all mathematicians" agree about, it
is primarily a question of usefulness. Both variants are common, it even
depends which university you're attending. Dogmatism are stupid, there
are good reasons why zero should be considered a positive integer and
there are also good reasons why it shouldn't. It's important to base
your decision on reason, not on "that's what I think everybody is doing".
I've never heard anybody call 0 a positive number, anywhere (other than in
signed zeroes, but I'm talking about math, not computing).
x is positive if x 0, nonnegative if x >= 0, negative if x < 0 and
nonpositive if x <= 0.
The thing about which mathematicians actually disagree is whether "natural
number" means "positive integer" or "negative integer".
Then again - in a trueley mathematic sense - almost all mathematicians
consider zero to be nonpositive. Almost all of them agree that zero is a
positive number, too. This is because "almost" in a mathematic sense
means "except for a finite number of exceptions" :-)
That definition only applies if the set of all mathematicians is infinite.

--
Army1987 (Replace "NOSPAM" with "email")
Dec 30 '07 #64

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.