---
title: "Discussion on \"Weighted Random\" | Hashnode"
description: "Discussion on \"Weighted Random\". Say we have an array and we want to get one element randomly. Instead of getting the element with equal probability, we want to specify the probability directly. This is called weighted random.\nFor example, if we have an array [\"a\", \"b\", \"c\"], then w..."
url: "https://hashnode.com/posts/weighted-random/631999465abe8613b3d3077d"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Weighted Random](https://blog.yaox023.com/weighted-random?utm_source=hashnode&utm_medium=feed)

Say we have an array and we want to get one element randomly. Instead of getting the element with equal probability, we want to specify the probability directly. This is called weighted random. For example, if we have an array \["a", "b", "c"\], then w...

Sep 8, 2022 · 3 min read · blog.yaox023.com  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#leetcode](https://hashnode.com/tag/leetcode)
-   [#algo](https://hashnode.com/tag/algo)

## Written by

[yaox023](https://hashnode.com/@yaox023)

@yaox023 · Tokyo, Japan

  
[View profile](https://hashnode.com/@yaox023)

A Software Developer in Tokyo

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
