[Scilab-users] create random values between [-1,1]
Stéphane Mottelet
stephane.mottelet at utc.fr
Fri Jun 10 16:19:06 CEST 2016
Le 10/06/2016 à 15:59, Jens Simon Strom a écrit :
> rand(n,1)–rand(n,1) is definitely NOT uniform.
by convolution the density of such a variable seems triangle shaped :
f(x)=1/2-abs(x)/4, if x \in [-2,2]
=0, elsewhere
S.
> Jens
> ------------------------------------------------------------------------------
> Am 10.06.2016 15:33, schrieb Samuel Gougeon:
>> Le 10/06/2016 15:21, Carrico, Paul a écrit :
>>>
>>> Hi
>>>
>>> In order to simulate dimensional tolerances in +/-, I’m using the
>>> following workaround :
>>>
>>> n = 100;
>>>
>>> a = rand(n,1) – rand(n,1);
>>>
>>> Of course I need to increase the N value to the domain … is there a
>>> more “clever” way ?
>>>
>> grand(n,1,"unf",-1,1)
>>
>> BTW, i am not sure that rand(n,1)–rand(n,1) builds (or keeps) a
>> uniform distribution over [-1, 1].
>>
>> Samuel
>>
>>
>>
>> _______________________________________________
>> users mailing list
>> users at lists.scilab.org
>> http://lists.scilab.org/mailman/listinfo/users
>
>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
--
Département de Génie Informatique
EA 4297 Transformations Intégrées de la Matière Renouvelable
Université de Technologie de Compiègne - CS 60319
60203 Compiègne cedex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20160610/a099fd57/attachment.htm>
More information about the users
mailing list