Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ErezShahaf authored Feb 7, 2024
1 parent 460c6e5 commit f908be7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ It is especially beneficial in functions that choose between a high amount of it
`npm install efficient-random-weighted`
## 📖 Examples
First, we create a weighted sampler. In the example below I have created a sampler that returns a reward of type number but it can support all types.
### Import
`import {WeightedSampler, createWeightedSampler} from 'efficient-random-weighted'`

### Create a sampler in Typescript
```
import {WeightedSampler, createWeightedSampler} from 'efficient-random-weighted'
const mySampler: WeightedSampler<number> = createWeightedSampler([
{ weight: 20, reward: 0 },
{ weight: 70, reward: 1 },
Expand All @@ -18,6 +18,7 @@ const mySampler: WeightedSampler<number> = createWeightedSampler([
```
### Create a sampler in Javascript
```
import {createWeightedSampler} from 'efficient-random-weighted'
const mySampler = createWeightedSampler([
{ weight: 20, reward: 0 },
{ weight: 70, reward: 1 },
Expand Down

0 comments on commit f908be7

Please sign in to comment.