leftultra.blogg.se

Random letters generator
Random letters generator







This means that "A"s and "Z"s will tend to congregate towards the end of the list. The loop just may be executing a few times more than necessary.ĮDIT3: The distribution will be skewed when using CInt because the probability of getting a 0 or 25 will be about half that of the other numbers, because of the rounding performed by CInt.

#Random letters generator code

(Mind you, it's early in the morning here, so my grey cell may not be be up to speed yet !)ĮDIT: Having had another cup of tea, I can see that the code will execute the Do loop until the appropriate cnt value is zero anyway, so that last paragraph does not apply. converting to 0.Īlso I'd expect fewer "Z"s since only values greater than 24.5 would return 25. However, I would expect there to be less "A"s since only values less than 0.5 would convert to 0 ("A") - rather than 0 to 0.9999999. I'm guessing that this would tend to skew the distribution. Naturally, I'm hesitant to ask him why it doesn't work properly as I was under the impression that's it "quite easy" for an experienced coder to create random letters. If x < 100 Then Selection.TypeText Text:=vbTabĮnd SubBTW this is for a family christmas game and a friend, of a friend, coded it for nothing. Selection.TypeText Text:=x - 1 & " " & ltr(curindex) The other instances, of lack of randomness, are so blindingly obvious I didn't have to the mathes.ĭim ltr As Variant, cnt As Variant, combination As String, curindex As Integer I still suspect it still appears more often ,than it should, in the last five cells but I haven't done the math to work out if that is the case. Before I changed the ratio of letters, the letter A appeared disproportionately in the last 5-6 cells as well. Sure, you get your odd grouping of letters but that is to be expectedĪlso.

random letters generator random letters generator

The thing is this only occurs in the last 5-6 cells the other 95 cells are random. The last five-six cells always have a disproportionate number of the same letters. It's suppose to randomly choose letters, from a set pool of letters, and fill the cells, in a table, with them.

random letters generator

I have a macro created with visual basic.







Random letters generator