Skip to content

Commit

Permalink
Init seed with random value
Browse files Browse the repository at this point in the history
  • Loading branch information
koenderks committed Nov 20, 2024
1 parent ba7bceb commit 3e05f44
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
8 changes: 5 additions & 3 deletions inst/qml/auditClassicalModelFairness.qml
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,11 @@ Form

IntegerField
{
name: "seed"
label: qsTr("Seed")
defaultValue: 1
name: "seed"
label: qsTr("Seed")
defaultValue: Math.floor(Math.random() * 1000); // Init with random integer in [1,...,999]
min: -999
max: 999
info: qsTr("Selects the seed for the random number generator in order to reproduce results.")
}
}
Expand Down
8 changes: 5 additions & 3 deletions inst/qml/auditClassicalNumberBunching.qml
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,11 @@ Form

IntegerField
{
name: "seed"
label: qsTr("Seed")
defaultValue: 1
name: "seed"
label: qsTr("Seed")
defaultValue: Math.floor(Math.random() * 1000); // Init with random integer in [1,...,999]
min: -999
max: 999
info: qsTr("Selects the seed for the random number generator in order to reproduce results.")
}
}
Expand Down
12 changes: 6 additions & 6 deletions inst/qml/common/selection/Seed.qml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ IntegerField
{
property bool enable: false

id: seed
text: qsTr("Seed")
name: "seed"
defaultValue: 1
min: 1
max: 99999
id: seed
text: qsTr("Seed")
name: "seed"
defaultValue: Math.floor(Math.random() * 1000); // Init with random integer in [1,...,999]
min: -999
max: 999
enabled: enable
info: qsTr("Selects the seed for the random number generator in order to reproduce results.")
}
2 changes: 2 additions & 0 deletions tests/testthat/test-auditclassicalnumberbunching.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ options$summaryTable <- TRUE
options$numberBunchingSimulationPlots <- TRUE
options$numberBunchingHistogram <- TRUE
options$noHeads <- 0
options$seed <- 1
set.seed(1)
results <- jaspTools::runAnalysis("auditClassicalNumberBunching", "numberBunching1.csv", options)

Expand Down Expand Up @@ -453,6 +454,7 @@ options$summaryTable <- TRUE
options$numberBunchingSimulationPlots <- TRUE
options$numberBunchingHistogram <- TRUE
options$noHeads <- 0
options$seed <- 1
set.seed(1)
results <- jaspTools::runAnalysis("auditClassicalNumberBunching", "numberBunching2.csv", options)

Expand Down

0 comments on commit 3e05f44

Please sign in to comment.