Skip to content

Commit

Permalink
create dotRandom and use instead of phet.joist.random, phetsims/joist…
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Jan 22, 2021
1 parent d60db75 commit 5ebd996
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion js/game/model/GameModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import NumberProperty from '../../../../axon/js/NumberProperty.js';
import Property from '../../../../axon/js/Property.js';
import StringProperty from '../../../../axon/js/StringProperty.js';
import dotRandom from '../../../../dot/js/dotRandom.js';
import Range from '../../../../dot/js/Range.js';
import GameTimer from '../../../../vegas/js/GameTimer.js';
import balancingChemicalEquations from '../../balancingChemicalEquations.js';
Expand All @@ -27,7 +28,7 @@ const BALANCED_REPRESENTATION_STRATEGIES = [
() => BalancedRepresentation.BALANCE_SCALES,

//level 2
() => phet.joist.random.nextDouble() < 0.5 ? BalancedRepresentation.BALANCE_SCALES : BalancedRepresentation.BAR_CHARTS,
() => dotRandom.nextDouble() < 0.5 ? BalancedRepresentation.BALANCE_SCALES : BalancedRepresentation.BAR_CHARTS,

// level 3
() => BalancedRepresentation.BAR_CHARTS
Expand Down
5 changes: 3 additions & 2 deletions js/game/model/RandomStrategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @author Chris Malley (PixelZoom, Inc.)
*/

import dotRandom from '../../../../dot/js/dotRandom.js';
import merge from '../../../../phet-core/js/merge.js';
import balancingChemicalEquations from '../../balancingChemicalEquations.js';
import BCEQueryParameters from '../../common/BCEQueryParameters.js';
Expand Down Expand Up @@ -50,15 +51,15 @@ class RandomStrategy {
assert && assert( poolCopy.length > 0 );

// randomly select an equation
const randomIndex = phet.joist.random.nextInt( poolCopy.length );
const randomIndex = dotRandom.nextInt( poolCopy.length );
let factoryFunction = poolCopy[ randomIndex ];

// If the first equation isn't supposed to contain any "big" molecules,
// then find an equation in the pool that has no big molecules.
if ( i === 0 && !this.firstBigMolecule && factoryFunction().hasBigMolecule() ) {

// start the search at a random index
const startIndex = phet.joist.random.nextInt( poolCopy.length );
const startIndex = dotRandom.nextInt( poolCopy.length );
let index = startIndex;
let done = false;
while ( !done ) {
Expand Down

0 comments on commit 5ebd996

Please sign in to comment.