Skip to content

Commit

Permalink
Merge pull request #25 from receptron/randint_2
Browse files Browse the repository at this point in the history
randomInt2 etc.
  • Loading branch information
isamu authored May 4, 2024
2 parents 07b4f20 + 4fa0812 commit 212a1df
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/utils/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ const arrays = (num: number) => {
const randomInt = (num: number) => {
return Math.floor(Math.random() * num);
};
const randomInt2 = (num: number) => {
return Math.floor((1 - Math.random() * Math.random()) * num);
};
export const generateGraph = (staticNode: number = 10, computedNode: number = 50, concurrency: number = 8): GraphData => {
const nodes: Record<string, NodeData> = {};
const inputsNode: string[] = [];
const outputNode: Record<number, string> = {};

Check failure on line 16 in src/utils/graph.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

'outputNode' is assigned a value but never used

arrays(staticNode).forEach((__i, k) => {
const name = "static_" + k;
inputsNode.push(name);
Expand All @@ -22,10 +27,15 @@ export const generateGraph = (staticNode: number = 10, computedNode: number = 50
const name = "node_" + k;

const inputs = arrays(randomInt(3) + 1).map(() => {
const rand = randomInt(inputsNode.length);
const rand = randomInt2(inputsNode.length);
return inputsNode[rand];
});

// Ensure that all static nodes are used by other nodes
if (k < staticNode) {
inputs.push(inputsNode[k]);
}

nodes[name] = {
agentId: "sleepTestAgent",
params: {
Expand Down

0 comments on commit 212a1df

Please sign in to comment.