-
-
Save Constans/08a83c0f8683145084b3593bffcdd6c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:math'; | |
class Randomizer { | |
num nextInRange(num a, num b) { | |
var rand = Random(); | |
num result = min(a, b); | |
num maximum = max(a, b); | |
if(a is double || b is double) { | |
result += rand.nextDouble()*maximum; | |
} else { | |
result += rand.nextInt(maximum); | |
} | |
return result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment