From: Herbert Kleebauer on 26 Aug 2007 16:31 santosh wrote: > Herbert Kleebauer wrote: > >> > - Does Linux provide a random number? Had to use the time > >> > as a workaround. > But what is wrong with the C standard library rand()? As far as I know, this is a pseudo random generator which always generates the same sequence when using the same seed. I only need one random number (as a seed for the internal pseudo random generator) so the generated map will be different on each invocation of the program. To use the time in seconds is a sufficient workaround here as long as you don't start the program twice within the same second. This way it is guaranteed, that you will not get the same map again within the next hundred years. But I hoped there would be an int80 call for a random number.
From: Herbert Kleebauer on 26 Aug 2007 16:38 Wolfgang Kern wrote: > Herbert Kleebauer wrote: > > > Just converted the Erde graphics demo to Linux. Maybe somebody can try it > > (use the mouse to fly, press any key or button to exit). The source in a > > follow up. You can find the DOS and Windows version here: > > ftp://137.193.64.130/pub/assembler/erde.zip > > A funny one KB code example, > it runs at windoze 98se/XPhome and the com-file runs without problems > in full screen mode under the very restricted KESYS DOS-emulator. The DOS version doesn't use any DOS call at all. Only int 0x1a, 0x33, 0x10, 0x16
From: T.M. Sommers on 26 Aug 2007 17:33 Herbert Kleebauer wrote: > santosh wrote: > >>But what is wrong with the C standard library rand()? > > As far as I know, this is a pseudo random generator which > always generates the same sequence when using the same seed. Correct. -- Thomas M. Sommers -- tms(a)nj.net -- AB2SB
From: Frank Kotler on 27 Aug 2007 00:49 Herbert Kleebauer wrote: .... > Only minor changes were necessary to convert it from Windows > to Linux. Two remaining small problems, maybe you know an answer: > > - Does Linux provide a random number? Had to use the time > as a workaround. Well, there's /dev/rand. Never used it. I assume that only provides a "seed". We can do better than "to the second" with time, I think. With that webcam attached, I get bytes from /dev/video that might be "random" enough to make a seed. :) > - Is there an easy way to hide the cursor without the need to > define a new cursor? I don't know. I suspect not. The old dos trick of moving it offscreen might work(?). > mod__sib(3,&op2); <- replace by: mod__sib(0,&op2); Okay... "seems to work", as is. Work for you, Betov? Best, Frank
From: Betov on 27 Aug 2007 03:20
Frank Kotler <fbkotler(a)verizon.net> �crivait news:oJsAi.6811$yv3.5735 @trndny01: > Work for you, Betov? :))))) shhhhhtttt. I am still trying to understand why Herbert would not make use of an Assembly Random, that could be initialized on RDTSC... Where is the problem? Then, a good and simple RND we have found, right here, was the delphi one: ________________________________________________________ [Seed: Q$ 06227_8134] Proc DelphiMaxRandom: Arguments @Max Uses ecx, edx mov eax D(a)Max imul edx D$Seed 0808_8405 inc edx mov D$Seed edx mul edx mov eax edx EndP ________________________________________________________ So... what? :)) Betov. < http://rosasm.org > Betov. < http://rosasm.org > |