https://github.com/kostasdrakonakis/randomizer
Initialize random variables assigned to primitive types
https://github.com/kostasdrakonakis/randomizer
android android-library random-number-generators randomize randomizer
Last synced: about 1 month ago
JSON representation
Initialize random variables assigned to primitive types
- Host: GitHub
- URL: https://github.com/kostasdrakonakis/randomizer
- Owner: kostasdrakonakis
- License: apache-2.0
- Created: 2019-02-19T16:09:57.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2025-12-30T07:10:19.000Z (about 1 month ago)
- Last Synced: 2026-01-02T18:43:41.379Z (about 1 month ago)
- Topics: android, android-library, random-number-generators, randomize, randomizer
- Language: Kotlin
- Size: 340 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
Randomizer [](https://github.com/kostasdrakonakis/randomizer/actions/workflows/android.yml)
Initialize variables with Random values
Download
--------
Download the latest JAR or grab via Maven:
```xml
com.kostasdrakonakis
randomizer
1.0.1
```
```xml
com.kostasdrakonakis
randomizer-compiler
1.0.1
```
or via Gradle:
Java:
```groovy
implementation 'com.kostasdrakonakis:randomizer:1.0.1'
annotationProcessor 'com.kostasdrakonakis:randomizer-compiler:1.0.1'
```
Kotlin:
```groovy
implementation 'com.kostasdrakonakis:randomizer:1.0.1'
kapt 'com.kostasdrakonakis:randomizer-compiler:1.0.1'
```
Usage
-----
You can use it in Activities or Fragments like:
Java
```java
public class MainActivity extends AppCompatActivity {
@RandomInt
int withoutRange;
@RandomInt(minValue = 10, maxValue = 100)
int withRange;
@RandomString
String normalString;
@RandomString(uuid = true)
String uuidString;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Randomizer.bind(this);
}
}
```
Kotlin
```kotlin
class MainActivity : AppCompatActivity() {
@RandomInt
@JvmField var withoutRange: Int = 0
@RandomInt(minValue = 10, maxValue = 100)
@JvmField var withRange: Int = 0
@RandomString
lateinit var normalString: String
@RandomString(uuid = true)
lateinit var uuidString: String
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Randomizer.bind(this)
setContentView(R.layout.activity_main)
}
}
```
Supported Annotations:
```text
@RandomInt // optional values: minValue and maxValue
@RandomString // optional value: uuid
@RandomFloat // optional values: minValue and maxValue
@RandomDouble // optional values: minValue and maxValue
@RandomChar
@RandomLong // optional values: minValue and maxValue
@RandomShort
```
CHANGELOG
----
**v1.0.0**:
* Add support for int, String, float, char, double, long, short types
* Add support for initializing with custom range
TODO
----
+ Add support for objects
Feel free to submit PR's. Also open to suggestions!
License
-------
Copyright 2018 Kostas Drakonakis
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.