Actionscript 3 , generating random numbers and placing in byte array, faster?
问题 I am trying to generate large byte arrays of random bytes. Using the below code I can generate 10 million random bytes and place in a byte array in about 4 seconds. 2 seconds for the generation and 2 second to place on the array. for (var i:Number = 0; i < reqLength; i++){ rnd = Math.random() * 255; randomBytes.writeByte(rnd); } Does a faster way exist? I am generating int s because I am creating a byte array of extended ASCII chars. 回答1: With a few tweaks I tuned it down from 4s to 0.5s. var