Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitde496a2

Browse files
committed
Update the cover for Weighted Random algorithm.
1 parent6837221 commitde496a2

File tree

1 file changed

+1
-1
lines changed
  • src/algorithms/statistics/weighted-random

1 file changed

+1
-1
lines changed

‎src/algorithms/statistics/weighted-random/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const weightedItems = [
5959
// And now just pick the random item from weightedItems array.
6060
```
6161

62-
However, as you may see, this approach may require a lot of memory, in case ifthe objects are heavy, andincaseifwe have a lot of themtorepeat in`weightedItems` list.
62+
However, as you may see, this approach may require a lot of memory, in case ifwe have a lot of items to repeatin`weightedItems` list. Think of it asifyou would need to repeat a string like`"some-random-string"` (`18` bytes) a ten million times. You will needtoallocate around`180Mb` of additional memory space just for this array.
6363

6464
The**more efficient approach** would be to:
6565

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp