Last change
on this file since 1308 was
1306,
checked in by rkrimmel, 11 years ago
|
Introducing a random sequence generator
|
File size:
578 bytes
|
Rev | Line | |
---|
[1306] | 1 | package de.ugoe.cs.autoquest.plugin.alignment.seqgen; |
---|
| 2 | import de.ugoe.cs.autoquest.eventcore.Event; |
---|
| 3 | import java.util.List; |
---|
| 4 | |
---|
| 5 | public class RandomSequenceGenerator implements SequenceGenerator { |
---|
| 6 | |
---|
| 7 | private int min; |
---|
| 8 | private int max; |
---|
| 9 | private int count; |
---|
| 10 | |
---|
| 11 | |
---|
| 12 | public RandomSequenceGenerator(int min, int max, int count) { |
---|
| 13 | this.min = min; |
---|
| 14 | this.max = max; |
---|
| 15 | this.count = count; |
---|
| 16 | } |
---|
| 17 | |
---|
| 18 | public int[] generate(List<Event> eventList) { |
---|
| 19 | int[] result = new int[count]; |
---|
| 20 | for (int i=0; i<count;i++) { |
---|
| 21 | result[i]= min + (int)(Math.random() * ((max - min)) + 1); |
---|
| 22 | } |
---|
| 23 | return result; |
---|
| 24 | } |
---|
| 25 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.