39 lines
790 B
Markdown
39 lines
790 B
Markdown
|
|
|
|
# Functions
|
|
|
|
<a id="randomasu8a"></a>
|
|
|
|
## randomAsU8a
|
|
|
|
▸ **randomAsU8a**(length?: *`number`*): `Uint8Array`
|
|
|
|
*Defined in [random/asU8a.ts:22](https://github.com/polkadot-js/common/blob/2d4097d/packages/util-crypto/src/random/asU8a.ts#L22)*
|
|
|
|
*__name__*: randomAsU8a
|
|
|
|
*__signature__*: randomAsU8a (length?: number = 32): Uint8Array
|
|
|
|
*__summary__*: Creates a Uint8Array filled with random bytes.
|
|
|
|
*__description__*: Returns a `Uint8Array` with the specified (optional) length filled with random bytes.
|
|
|
|
*__example__*:
|
|
|
|
```javascript
|
|
import { randomAsU8a } from '@polkadot/util-crypto';
|
|
|
|
randomAsU8a(); // => Uint8Array([...])
|
|
```
|
|
|
|
**Parameters:**
|
|
|
|
| Name | Type | Default value |
|
|
| ------ | ------ | ------ |
|
|
| `Default value` length | `number` | 32 |
|
|
|
|
**Returns:** `Uint8Array`
|
|
|
|
___
|
|
|