Reduced String generation while still fixing the original bug

This commit is contained in:
Speiger 2022-05-21 19:45:13 +02:00
parent 2fe297b708
commit b60f4ff1fd
2 changed files with 5 additions and 6 deletions

View File

@ -5,7 +5,7 @@ repositories {
} }
archivesBaseName = 'Simple Code Generator' archivesBaseName = 'Simple Code Generator'
version = '1.1.3' version = '1.1.4'
apply plugin: 'maven' apply plugin: 'maven'
tasks.withType(JavaCompile) { tasks.withType(JavaCompile) {

View File

@ -1,19 +1,18 @@
package speiger.src.builder.misc; package speiger.src.builder.misc;
import java.util.Random; import java.util.concurrent.atomic.AtomicInteger;
public class IdGenerator public class IdGenerator
{ {
StringBuilder builder = new StringBuilder(); AtomicInteger integer = new AtomicInteger();
Random rand = new Random(24912012592L);
public void appendId() public void appendId()
{ {
builder.insert(0, rand.nextInt(10)); integer.incrementAndGet();
} }
public String getId() public String getId()
{ {
return "#ignoreLine"+builder.toString()+"suffix"; return "#ignoreLine"+integer.get()+"suffix";
} }
} }