random.d.ts 870 B

12345678910111213141516171819202122232425262728
  1. /**
  2. * Returns a random byte array by the given bytes size
  3. * @param size - The size of the random byte array returned
  4. * @returns - random byte array
  5. *
  6. * @example
  7. * ```ts
  8. * console.log(web3.utils.randomBytes(32));
  9. * > Uint8Array(32) [
  10. * 93, 172, 226, 32, 33, 176, 156, 156,
  11. * 182, 30, 240, 2, 69, 96, 174, 197,
  12. * 33, 136, 194, 241, 197, 156, 110, 111,
  13. * 66, 87, 17, 88, 67, 48, 245, 183
  14. * ]
  15. * ```
  16. */
  17. export declare const randomBytes: (size: number) => Uint8Array;
  18. /**
  19. * Returns a random hex string by the given bytes size
  20. * @param byteSize - The size of the random hex string returned
  21. * @returns - random hex string
  22. *
  23. * ```ts
  24. * console.log(web3.utils.randomHex(32));
  25. * > 0x139f5b88b72a25eab053d3b57fe1f8a9dbc62a526b1cb1774d0d7db1c3e7ce9e
  26. * ```
  27. */
  28. export declare const randomHex: (byteSize: number) => string;