12,505,591 members (53,313 online)
Rate this:
See more:
Hi,

I want to generate a random number between a range of value say from (-10 to 10).
The generated random number should be same for any number of attempts in this range.

If -10 to 10 give 4.526325631
then if i give -10 to 10 for 100 times then the number generated should be 4.526325631.

How can i acheive it?
Posted 3-Dec-12 4:53am

Rate this:

## Solution 3

Don't use random numbers.

What part of the phrase "Random number" is confusing you?
When you generate a random number between an upper an a lower limit you have no idea what the number will be - that is the whole idea of "random" Over time and sufficient numbers it will trend to the mean of the upper and lower bounds, but you cannot skew it towards any particular value - or it looses all semblance of randomness.
Rate this:

Rate this:

## Solution 1

Hello,

Can you please clarify, you state you want a random number but then you state the number should always be 4.526325631.

Top Experts
Last 24hrsThis month
 OriginalGriff 253 Karthik Bangalore 235 David_Wimbley 215 Maciej Los 200 ppolymorphe 171
 OriginalGriff 7,386 ppolymorphe 3,980 Maciej Los 3,741 David_Wimbley 3,087 Karthik Bangalore 2,977