Skip to content

Commit e2a7e6c

Browse files
Update code/stl/solution/randomize.sol.cpp
Co-authored-by: Stephan Hageboeck <stephan.hageboeck@cern.ch>
1 parent a52a424 commit e2a7e6c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

code/stl/solution/randomize.sol.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ void compute(int len, T initial, T step) {
4040
// compute differences
4141
std::adjacent_difference(v.begin(), v.end(), diffs.begin());
4242

43-
// compute standard deviation of it
43+
// compute standard deviation of all differences.
44+
// Note that the first element is just the original element itself, so we need to skip it.
4445
const T sum = std::reduce(diffs.begin()+1, diffs.end(), T());
4546
const T sumsq = std::reduce(diffs.begin()+1, diffs.end(), T(), sumsquare<T>());
4647
// Alternatively:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy