Refactor waveform factory function

This commit is contained in:
jonnyandrew 2023-10-27 15:07:02 +01:00
parent a07286ace9
commit 7ebea4acf1
No known key found for this signature in database
GPG key ID: 0D58D4EF33D27015
3 changed files with 13 additions and 15 deletions

View file

@ -20,17 +20,15 @@ import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.toPersistentList
import kotlin.random.Random
object FakeWaveformFactory {
/**
* Generate a waveform for testing purposes.
*
* The waveform is a list of floats between 0 and 1.
*
* @param length The length of the waveform.
*/
fun createFakeWaveform(length: Int = 1000): ImmutableList<Float> {
val random = Random(seed = 2)
return List(length) { random.nextFloat() }
.toPersistentList()
}
/**
* Generate a waveform for testing purposes.
*
* The waveform is a list of floats between 0 and 1.
*
* @param length The length of the waveform.
*/
fun createFakeWaveform(length: Int = 1000): ImmutableList<Float> {
val random = Random(seed = 2)
return List(length) { random.nextFloat() }
.toPersistentList()
}