473,385 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Positive random number

Hi,

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

Thanks,
Deepak
Dec 18 '07
63 5579
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Virus | last post by:
Ok well what I am trying to do is have 1.) the background color to change randomly with 5 different colors.(change on page load) 2,) 10 different quotes randomly fadeing in and out in random...
10
by: Johnny Snead | last post by:
Hey guys, Need help with this random sort algorithm private void cmdQuestion_Click(object sender, System.EventArgs e) { Random rnd = new Random(); //initialize rnd to new random object...
4
by: fatimahtaher | last post by:
Hi, I am supposed to create a program that generates a random number and then asks the user to guess the number (1-100). The program tells the user if he guessed too high or too low. If he...
13
by: Peter Oliphant | last post by:
I would like to be able to create a random number generator that produces evenly distributed random numbers up to given number. For example, I would like to pick a random number less than 100000,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.