winterhazel commented on code in PR #12598:
URL: https://github.com/apache/cloudstack/pull/12598#discussion_r2769574725
##########
framework/db/src/main/java/com/cloud/utils/db/Filter.java:
##########
@@ -57,8 +57,21 @@ public Filter(Class<?> clazz, String field, boolean
ascending) {
}
public Filter(long limit) {
- _orderBy = " ORDER BY RAND()";
- _limit = limit;
+ this(limit, true);
+ }
+
+ /**
+ * Constructor for creating a filter with random ordering
+ * @param limit the maximum number of results to return
+ * @param randomize if true, orders results randomly
+ */
+ public Filter(long limit, boolean randomize) {
+ if (randomize) {
+ _orderBy = " ORDER BY RAND()" ;
+ _limit = limit;
+ } else {
+ _limit = limit;
+ }
Review Comment:
```suggestion
_limit = limit;
if (randomize) {
_orderBy = " ORDER BY RAND()" ;
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]