Skip to content

Commit 1501973

Browse files
committed
tweak discreteRnd
1 parent f20e50e commit 1501973

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

chapter11/discreteRnd.m

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,4 @@
99
if nargin == 1
1010
n = 1;
1111
end
12-
r = rand(1,n);
13-
p = cumsum(p(:));
14-
[~,~,x] = histcounts(r,[0;p/p(end)]);
12+
[~,~,x] = histcounts(rand(1,n),[0;cumsum(p(:))]);

0 commit comments

Comments
 (0)