All~

We could try to keep the opcode count down by simply having a seed opcode and an opcode to produce n random bytes... Anyone who wants more specific ranges could do the modulus and addition themselves.

Matt

Leopold Toetsch wrote:
Almost forgotten about that, but I've checked in some days ago the base of Hash randomization, which is basically most of a ?rand48 library.

I don't know if its useful or practically usable with HLL code generation but I've added to these randon function interface a how_random parameter, which could mean (in linux-speak):
0 ... internal current functions
1 ... /dev/urandom
2 ... /dev/random
3 ... maybe ultra hardware something


Anyway, we could add some opcodes for this like:

  srand Iseed, Ilevel         # seed rand for Ilevel
  rand Idest, Ilevel          # rand from 0..LIMIT
  rand Idest, Ifrom, Ito, Ilevel
  rand Ndest, Ilevel
  rand Sdest, Ilen, Pchar-ranges, Ilevel

where operands are meaning:

Iseed ... some input rand seed
Ilevel ... the how_random level
Ifrom, Ito ... range of returned random ints
Ndest ... random from 0.0 ... 1.0
Sdest ... new random string of len Ilen composed of chars in the Pchar-ranges ... range array which has from-to pairs


Better proposals & comments welcome,
leo






Reply via email to