1 | # n
|
2 |
|
3 | ```js
|
4 | // usage
|
5 | chance.n(chance.email, 5)
|
6 | chance.n(chance.email, 5, { domain: "socialradar.com" })
|
7 | ```
|
8 |
|
9 | Provide any function that generates random stuff (usually another **Chance** function) and a number and `n()` will generate an array of items with a length matching the length you specified.
|
10 |
|
11 | For example, to generate 5 email addresses:
|
12 |
|
13 | ```js
|
14 | chance.n(chance.email, 5);
|
15 | => [ 'nese@me.gov',
|
16 | 'tukvogi@novew.co.uk',
|
17 | 'worzi@jotok.edu',
|
18 | 'wicumafom@lalu.edu',
|
19 | 'hifebwo@abecusa.com' ]
|
20 | ```
|
21 |
|
22 | Any options that would be sent to the random function can be added following the number.
|
23 |
|
24 | For example, `chance.email()` has options which can be specified, so you can generate 5 emails with a known domain as follows:
|
25 |
|
26 | ```js
|
27 | chance.n(chance.email, 5, { domain: "socialradar.com" })
|
28 | => [ 'nuvvu@socialradar.com',
|
29 | 'icolul@socialradar.com',
|
30 | 'rig@socialradar.com',
|
31 | 'ca@socialradar.com',
|
32 | 'uc@socialradar.com' ]
|
33 | ```
|
34 |
|
35 | Note, these items are not guaranteed to be unique. If that is the intent, see [`chance.unique()`](http://chancejs.com/#unique)
|