Skip to content

Commit 89e6408

Browse files
authored
Merge pull request #46 from CrossroadW/awesome-fix-1
Update cpp_tricks.md: gen(std::random_device()()); 会被当成函数,无法编译
2 parents ed9392e + b80e679 commit 89e6408

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/cpp_tricks.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ int main() {
725725
如果喜欢老式的函数调用风格接口,可以封装一个新的 C++ 重置版安全 `rand`
726726

727727
```cpp
728-
thread_local std::mt19937 gen(std::random_device()()); // 每线程一个,互不冲突
728+
thread_local std::mt19937 gen(std::random_device{}()); // 每线程一个,互不冲突
729729

730730
int randint(int min, int max) {
731731
return std::uniform_int_distribution<int>(min, max)(gen);

0 commit comments

Comments
 (0)