2022-10-21 17:16:00 +02:00
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home ](./index.md ) > [bitburner ](./bitburner.md ) > [NS ](./bitburner.ns.md ) > [hackAnalyzeThreads ](./bitburner.ns.hackanalyzethreads.md )
## NS.hackAnalyzeThreads() method
2023-02-17 09:14:20 +01:00
Calculate the decimal number of threads needed to hack a specified amount of money from a target host.
2022-10-21 17:16:00 +02:00
2023-02-11 19:18:50 +01:00
**Signature:**
2022-10-21 17:16:00 +02:00
```typescript
hackAnalyzeThreads(host: string, hackAmount: number): number;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| host | string | Hostname of the target server to analyze. |
| hackAmount | number | Amount of money you want to hack from the server. |
2023-02-11 19:18:50 +01:00
**Returns:**
2022-10-21 17:16:00 +02:00
number
The number of threads needed to hack the server for hackAmount money.
## Remarks
RAM cost: 1 GB
2024-11-11 01:27:35 +01:00
This function returns the decimal number of script threads you need when running the hack command to steal the specified amount of money from the target server. If hackAmount is less than zero, greater than the amount of money available on the server, or your hacking level is below the required level for the target server, then this function returns -1.
2022-10-21 17:16:00 +02:00
## Example
2024-05-27 23:42:31 +02:00
```js
2024-08-04 22:09:50 +02:00
// Calculate the thread count of a single hack that would take $100k from n00dles
2024-05-23 10:42:47 +02:00
const hackThreads = ns.hackAnalyzeThreads("n00dles", 1e5);
2023-02-17 09:14:20 +01:00
// Launching a script requires an integer thread count. The below would take less than the targeted $100k.
2024-05-27 23:42:31 +02:00
ns.run("noodleHack.js", Math.floor(hackThreads));
2023-02-17 09:14:20 +01:00
2022-10-21 17:16:00 +02:00
```