Merge pull request #5042 from fmm/patch-1

Update FindKthLargest.java
This commit is contained in:
Loredana Crusoveanu 2018-10-05 15:54:56 +03:00 committed by GitHub
commit 1a4fe225af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -98,7 +98,7 @@ public class FindKthLargest {
private int randomPartition(Integer arr[], int left, int right) {
int n = right - left + 1;
int pivot = (int) (Math.random()) % n;
int pivot = (int) (Math.random() * n);
swap(arr, left + pivot, right);
return partition(arr, left, right);
}