Sitelet https://web.archive.org/web/20220404154855/https://github.com/arrayfire/arrayfire/issues/3223
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to set µ (mean) and σ (standard deviation) of randn #3223

Open
jansende opened this issue Feb 19, 2022 · 4 comments
Open

Add option to set µ (mean) and σ (standard deviation) of randn #3223

jansende opened this issue Feb 19, 2022 · 4 comments
Labels

Comments

@jansende
Copy link

@jansende jansende commented Feb 19, 2022 •

I was playing with adding noise to images and noticed that randn does not support setting the mean µ and the standard deviation σ of its distribution. For the moment, I used std::normal_distribution to get the desired effect, but I think these settings should be added to the randn function.

@villekf
Copy link

@villekf villekf commented Feb 28, 2022

You can easily add the mean and standard deviation to normally distributed values by simply using x = µ + randn(N) * σ.

@jansende
Copy link
Author

@jansende jansende commented Mar 4, 2022

It took me a while to understand why this is actually true. I did not know that. Therefore it might be a good idea to extend the function definition with these parameters, or at least add your explanation to the documentation.

@9prady9
Copy link
Member

@9prady9 9prady9 commented Mar 5, 2022

Sure, I think a line added to randn documentation could work as an example. However, I think this kind of operation is not specific to this function - these are element wise operations covered in the following tutorials

@jerrymatjila
Copy link

@jerrymatjila jerrymatjila commented Apr 4, 2022

@villekf can you kindly provide an example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants