Commit 4c7ae55ea2df8d52977d122b65825b9350020303
Don't share counter state in random example
Nick Niemeir committed on 6/22/2016, 8:02:52 PMParent: 3761392134a6c580635137cb17b6e3d109e0eac5
Files changed
README.md | changed |
README.md | ||
---|---|---|
@@ -68,10 +68,10 @@ | ||
68 | 68 | Unless, it is a call to abort the stream (`read(truthy, cb)`). |
69 | 69 | |
70 | 70 | ```js |
71 | 71 | //a stream of 100 random numbers. |
72 | -var i = 100 | |
73 | 72 | var random = function () { |
73 | + var i = 100 | |
74 | 74 | return function (end, cb) { |
75 | 75 | if(end) return cb(end) |
76 | 76 | //only read 100 times |
77 | 77 | if(i-- < 0) return cb(true) |
Built with git-ssb-web