smp
05-26-2010, 12:03 AM
Hi,
I want to generate random numbers between -0.5 to +0.5.
I am using ran1() function, first to generate random numbers between 0.0 and 1.0.
Then I subtract 0.5 from each of these random numbers and then the result is multiplied by 10.
Is this trick a good one, as far as random numbers will be used for scientific purpose.
If not, please let me know the better one.
Or, is there any DIRECT method to generate RNs between -N to +N i.e. without "scaling thing mentioned above"?
Thanks,
smp
I want to generate random numbers between -0.5 to +0.5.
I am using ran1() function, first to generate random numbers between 0.0 and 1.0.
Then I subtract 0.5 from each of these random numbers and then the result is multiplied by 10.
Is this trick a good one, as far as random numbers will be used for scientific purpose.
If not, please let me know the better one.
Or, is there any DIRECT method to generate RNs between -N to +N i.e. without "scaling thing mentioned above"?
Thanks,
smp