Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetString() generates strings of length GetUint32() #114

Open
mdbooth opened this issue Mar 22, 2024 · 2 comments
Open

GetString() generates strings of length GetUint32() #114

mdbooth opened this issue Mar 22, 2024 · 2 comments

Comments

@mdbooth
Copy link

mdbooth commented Mar 22, 2024

I was trying to work out why struct generation always failed, no matter how large I made the size of the input bytes. The answer was $SUBJECT. I don't have enough RAM for more than a couple of strings to be up to 4GB in size, let alone a statistically significant number of structs containing many such strings each.

What did I miss?

@eprst
Copy link

eprst commented Jun 13, 2024

Hit the same thing. I think it is a bug or close to a bug. It also generates completely random bytes which are not necessarily a valid unicode.

My workaround: write a custom GetString(maxLength int), which does roughly (pseudocode)

lengh := abs(int(GetUint64)) % maxLength
bytes := GetNBytes(length)
return string(bytes)

with optional conversion to the ascii range:

for i := range bytes {
	bytes[i] = (bytes[i] % 94) + 32
}

@mdbooth
Copy link
Author

mdbooth commented Jun 18, 2024

FYI I have concluded that this library isn't ready for prime time. I went looking for correct uses of it, and it turns out that all the references are bogus. This is not the real deal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants