answersLogoWhite

0


Best Answer

Use a pseudo-random number generator to produce random integers. To determine if a given integer is odd or even, use the following functions:

bool is_odd (int x) {

return x%2;

}

bool is_even (int x) {

return !is_odd (x);

}

User Avatar

Wiki User

6y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How write a java program to generate random numbers in between 0-100 and print only the odd numbers?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Which function is used to randomize number in Excel?

There is a RAND function which can generate random numbers. The RANDBETWEEN function can generate numbers between a lower and upper limit.There is a RAND function which can generate random numbers. The RANDBETWEEN function can generate numbers between a lower and upper limit.There is a RAND function which can generate random numbers. The RANDBETWEEN function can generate numbers between a lower and upper limit.There is a RAND function which can generate random numbers. The RANDBETWEEN function can generate numbers between a lower and upper limit.There is a RAND function which can generate random numbers. The RANDBETWEEN function can generate numbers between a lower and upper limit.There is a RAND function which can generate random numbers. The RANDBETWEEN function can generate numbers between a lower and upper limit.There is a RAND function which can generate random numbers. The RANDBETWEEN function can generate numbers between a lower and upper limit.There is a RAND function which can generate random numbers. The RANDBETWEEN function can generate numbers between a lower and upper limit.There is a RAND function which can generate random numbers. The RANDBETWEEN function can generate numbers between a lower and upper limit.There is a RAND function which can generate random numbers. The RANDBETWEEN function can generate numbers between a lower and upper limit.There is a RAND function which can generate random numbers. The RANDBETWEEN function can generate numbers between a lower and upper limit.


What does it mean to generate random numbers in Java?

Generating random numbers in Java is somewhat of a misnomer because the numbers are actually semi-random.It means to use the program to obtain random integers to use in hypothetical situations such as statistics.


How can random numbers be generated in Java?

Random numbers can be generated in Java using the "random" class. One needs a single "random" object to generate a series of random numbers as a unit.


What is a random number table?

Random numbers (or random deviates) are numbers chosen totally by chance, but also conform to a certain distribution. The most common distribution is the uniform distribution. If I say that a number is chosen totally by chance between 1 and 100, and there is equal chance that every number between 1 and 100 can be chosen, then this is a uniformly distributed random number. If I list these generated numbers in a table, then this is a random number table. A program like Excel can easily generate uniform random numbers from 0 to 1, by entering +rand() into a column in the spreadsheet. To calculate a new table, press F9.


What is a randbetween in a spreadsheet?

Randbetween allows you to generate random numbers with a range. You specify the lowest and highest that you want the number to be between. So if you wanted to generate a random number between 1 and 100, you would enter: =RANDBETWEEN(1,100) If you wanted to generate a random number between 25 and 60, you would enter: =RANDBETWEEN(25,60) The function will generate a new random number every time you make a change to the spreadsheet or press the F9 key. So if you want to retain the random numbers it generates, you could copy them and then do a Paste Special and choose Values. You could paste this on top of the original values or in a new location.


How do you write C program to print a Series of Odd Numbers and Even Numbers.?

Generate a random number in half the range you are interested in. If generating odd values, subtract 1 from the upper bound of the range. That is, if the range is 0 to 100, then generate a random number in the range 0 to 50 for even numbers and 0 to 49 for odd numbers. Double the generated number to obtain the even value, or double it and add 1 to obtain the odd value.


A pollster uses a computer to generate 500 random numbers then interviews the voters corresponding to those numbers?

Cluster Sampling


How do you generate random numbers in Excel?

You can use the RAND function or the RANDBETWEEN function.


How do you make cmd generate a random number between two variables that can be changed at anytime?

In DOS, the following line will generate a random number between 1 and 100. To get 0-100, remove the plus one at the end. set /a num=%random% %%100 +1


How do you generate true random numbers?

True random numbers need a number frame to give it space. Try perl. type in $randomnumber1=int(rand(200))+1; you can change the 200 to anything you like and it will generate a random number between whatever your number is and one.


How would generate a random sample?

Each item in the population has an equal chance to be chosen. Usually a computer algorithm is used to generate a set of random numbers (most spreadsheet . Then the items are chosen using the set of random numbers, either as they come off the assembly line or if they are serialized, you can just go pick those items.


What does the rand between function do in Excel?

It allows you to generate a random number between a range. So say you want to get a random number between 1 and 100, then you would use the RANDBETWEEN function like this:=RANDBETWEEN(1,100)It is a dynamic function, meaning every time something changes on the spreadsheet, it regenerates new numbers. This will also happen if you press the F9 key. It is a good function to get a set of numbers quickly and to test functions with, removing the need for you to create a load of random numbers yourself.