-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest2
37 lines (32 loc) · 767 Bytes
/
test2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import 'dart:math';
void main() {
var arr = [];
int randomNumber;
int randomNumberN;
int snum=0;
for (int r = 0; r < 10; r++) {
Random random = Random();
randomNumber = random.nextInt(100);
randomNumberN= random.nextInt(100);
// print (randomNumber - randomNumberN);
int newrand = randomNumber - randomNumberN;
if (arr.contains(newrand)){
//print('Dup found.');
r = r -1 ;
}
else{
arr.add((randomNumber - randomNumberN));
//arr.add(1);
}
}
print("My array; ");
print(arr);
for (int i in arr){
if (i < 0 ){
if (snum > i){
snum = i;
}
}
}
print("Smalles at Position: " + arr.indexOf(snum).toString() + " / Num: " + snum.toString());
}