Skip to content

Commit

Permalink
Fix code scanning alert no. 157: Insecure randomness
Browse files Browse the repository at this point in the history
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
  • Loading branch information
robfrank and github-advanced-security[bot] authored Jan 15, 2025
1 parent f086acb commit 0131fa1
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import com.arcadedb.query.sql.executor.CommandContext;
import com.arcadedb.query.sql.function.SQLFunctionAbstract;

import java.util.*;
import java.security.SecureRandom;

/**
* Generates a random number integer between 0 and the number passed as parameter.
Expand All @@ -47,7 +47,7 @@ public Object execute(final Object iThis, final Identifiable iCurrentRecord, fin

int bound = iParams[0] instanceof Number ? ((Number) iParams[0]).intValue() : Integer.parseInt(iParams[0].toString());

return new Random().nextInt(bound);
return new SecureRandom().nextInt(bound);
}

@Override
Expand Down

0 comments on commit 0131fa1

Please sign in to comment.