So I was thinking about something, we have all these random number functions yet not a random letter generator and yeah it might be easier to make an ascii generator using numerical representation. but i have this function
On the face it looks like it will return a single array index from that chararray, yet when printed, it prints from the random char to the end. for example
will print if ânâ is selected.
how can i print only a single letter from vaild fstring ?
edit - i wonder if printing the [0] index of the result from (&vaild.GetCharArray()[FMath::RandRange(0, vaild.Len())])
Thatâs a fair assertion. I am really tired xD. Iâm pretty sure actually if we use just len() though it will give us a potentially out of bound number. so len()-1 would work right because of the escape character ?
edit actually i think your code will also give you the problem above. idk though. i think the magic is in the *âFString(1, &rtnStr[0])â *because its only the first character in the array.
Granted youâll want to change the min to 32 as the first 32 entries are non displayable entries.
but yeah awesome stuff ill test it here shortly.
edit : tried your function, i made a tiny change
Result += FMath::RandRange(33, 126);
since, 0 - 31 will give you non displayables, 32 is space, if you want spaces change 33 to 32, but i also got rid of potential deletes too, but yes, this is a much better function. thanks.