Bug (kind-of) in randn()
Version 1.0.0.0 (1.13 KB) by
Arvind
The first number generated by randn() after a seed-reset is always positive!
This is a very strange bug in randn(). After every seed-reset, the first call to randn() almost invarably produces a postive number. Most of the time this is a benign defect, but sometimes folks seek to make a random sequence of 1s and 0s using randn>0. If you tried to do this, and reset the seed between every call to randn, then you will get a long sequence of ones. Not random!
Cite As
Arvind (2024). Bug (kind-of) in randn() (https://www.mathworks.com/matlabcentral/fileexchange/22208-bug-kind-of-in-randn), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2007a
Compatible with any release
Platform Compatibility
Windows macOS LinuxCategories
Find more on Random Number Generation in Help Center and MATLAB Answers
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |