# snap_getEntropy

> Reference documentation for the `snap_getEntropy` method of the Snaps API.

<SnapsAPIReference method={{"name":"snap_getEntropy","description":"Get a deterministic 256-bit entropy value, specific to the Snap and the\nuser's account. You can use this entropy to generate a private key, or any\nother value that requires a high level of randomness. Other Snaps can't\naccess this entropy, and it changes if the user's secret recovery phrase\nchanges.\n\nYou can optionally specify a salt to generate different entropy for different\npurposes. Using a salt results in entropy unrelated to the entropy generated\nwithout a salt.\n\nThis value is deterministic: it's always the same for the same Snap, user\naccount, and salt.","parameters":{"kind":"object","type":"{ version: 1; salt?: string | null; source?: string | null }","description":"An object containing the parameters for the `snap_getEntropy` method.","required":true,"properties":[{"kind":"primitive","type":"1","description":"The version of the entropy to retrieve. This is reserved for future use,\nand as of now, only version 1 is supported.","name":"version","required":true},{"kind":"primitive","type":"string | null","description":"An arbitrary string to be used as a salt for the entropy. This can be used\nto generate different entropy for different purposes.","name":"salt","required":false},{"kind":"primitive","type":"string | null","description":"The ID of the entropy source to use. If not specified, the primary entropy\nsource will be used. For a list of available entropy sources, see the\n`snap_listEntropySources` method.","name":"source","required":false}]},"result":{"kind":"primitive","type":"`0x${string}`","description":"The entropy as a hexadecimal string."},"examples":[{"examples":[{"name":"Manifest","language":"json","content":"{\n  \"initialPermissions\": {\n    \"snap_getEntropy\": {}\n  }\n}\n"},{"name":"Usage","language":"ts","content":"const entropy = await snap.request({\n  method: 'snap_getEntropy',\n  params: {\n    version: 1,\n    salt: 'foo', // Optional.\n  },\n})\n\n// '0x...'\nconsole.log(entropy)\n"}]}],"subjectTypes":["snap"],"restricted":true}}  />
