Histogram

Hello everyone,
i have one stupid question about randon number generator. how can i limit the intervalle of randon number which i would like to generate? for exemple in Excel if i want to generate a number between [30, 50] i write in one cell "= 30+rand()*(50-30)" how can i do it with "gnoise function for exemple"?

thanks in advend

Bella
You don't want gnoise - this produces a random number that can (in principle) vary from -inf to +inf, but with a gaussian probability distribution.
I think you want enoise which has a uniform (flat) probability distribution.
To achieve the equivalent of your Excel code try:
print enoise(10)+40

I suggest you read the help associated with these functions. Type this into your command line:
DisplayHelpTopic("Noise Functions")

Hope this helps,
Kurt
Thanks Kurt,
but i would like to know the meaning of 10 and 40 in your exemple, is it that we make a random number between 10 and 40 [10,40] or what? please can we choose my exemple or another exemple that show how to generate a random number limited by a minimum and a maximum.
i have read the noise functions but i think it is not mentioned in the noise functions how to generate a random number between one maximum and one minimum.

bella2013
It creates noise varying from -10 to +10 (to achieve your range of 20). Then you add 40 to shift the range to +30 to +50.
Bella,

I think you want

( ( ( enoise ( range ) + range ) / 2 ) + MinOfRange )

In your example this becomes

( ( ( enoise ( 20 ) + 20 ) / 2 ) + 30)

enoise will return [-20, 20]
so you get ( ( [-20, 20] + 20 ) / 2 ) + 30
reducing...
( [0, 40 ] / 2 ) + 30
[0, 20] + 30
[30, 50]

enoise includes the endpoints.

bella wrote:
Hello everyone,
i have one stupid question about randon number generator. how can i limit the intervalle of randon number which i would like to generate? for exemple in Excel if i want to generate a number between [30, 50] i write in one cell "= 30+rand()*(50-30)" how can i do it with "gnoise function for exemple"?

thanks in advend

Bella

thank you,
i can start yet with my histogram.
thanks everybody.
Bella