Re: [fpc-pascal] random numbers negative

2011-08-16 Thread waldo kitty
On 8/16/2011 12:05, Felipe Monteiro de Carvalho wrote: Another idea: -1 * Random(127); this was what i was thinking of as it doesn't limit the number to any particular size as the following seems to do... random(128)-127; what would happen with this? random(4096)-127; ;) ___

Re: [fpc-pascal] random numbers negative

2011-08-16 Thread waldo kitty
On 8/16/2011 11:54, Luis Fernando Del Aguila Mejía wrote: thansk El 16/08/2011 10:36 a.m., Jonas Maebe escribió: On 16 Aug 2011, at 17:25, Luis Fernando Del Aguila Mejía wrote: I have a doubt. With the random function, Can you generate random numbers negative? Begin randomize; Writeln (rando

Re: [fpc-pascal] random numbers negative

2011-08-16 Thread Felipe Monteiro de Carvalho
Another idea: -1 * Random(127); -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] random numbers negative

2011-08-16 Thread Luis Fernando Del Aguila Mejía
thansk El 16/08/2011 10:36 a.m., Jonas Maebe escribió: On 16 Aug 2011, at 17:25, Luis Fernando Del Aguila Mejía wrote: I have a doubt. With the random function, Can you generate random numbers negative? Begin randomize; Writeln (random (-127)) / / 0> = n> -127 End. random(128)-127; Jonas

[fpc-pascal] random numbers negative

2011-08-16 Thread Luis Fernando Del Aguila Mejía
I have a doubt. With the random function, Can you generate random numbers negative? Begin randomize; Writeln (random (-127)) / / 0> = n> -127 End. thanks. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/l

Re: [fpc-pascal] Random numbers

2006-03-10 Thread Michalis Kamburelis
Antal wrote: It's not just that, but randseed is not a threadvar. This means that all your threads use the same randseed variable, so if two threads call "random" at the same time they will still get the same "random" number. Jonas And also generating a rand * getpid you can't really get goo

Re: [fpc-pascal] Random numbers

2006-03-08 Thread Michalis Kamburelis
(Second send, it seems that mails from my old email address do not reach fpc lists) Antal wrote: It's not just that, but randseed is not a threadvar. This means that all your threads use the same randseed variable, so if two threads call "random" at the same time they will still get the same "

Re: [fpc-pascal] Random numbers

2006-03-06 Thread miller
Quoting Vinzent Hoefler <[EMAIL PROTECTED]>: > The Mersenne Twister Free Pascal uses is one of the best PRNGs known > today, it just has to be used the right way. But calling it from > several threads and "randomly" overwriting its state array is > definitely not the right way to use it. Well

Re: [fpc-pascal] Random numbers

2006-03-06 Thread Graeme Geldenhuys
Why not use GUID's (or the other name is UUID's) and convert them to a Integer from Hex. You might need to make the GUID value smaller, or part of the GUID (example the last block). Regards, - Graeme - On 3/3/06, Antal <[EMAIL PROTECTED]> wrote: > > > > It's not just that, but randseed is n

Re: [fpc-pascal] Random numbers

2006-03-05 Thread Vinzent Hoefler
On Friday 03 March 2006 11:06, Antal wrote: > Maybe a bit shifting or some aritmetical function can help to > obtain a more random "looking" number. No. Don't do that: |Random numbers should not be generated with a method chosen at random. | -- Donald E. Knuth |The generation of random nu

[fpc-pascal] Random numbers

2006-03-04 Thread Antal
It's not just that, but randseed is not a threadvar. This means that all your threads use the same randseed variable, so if two threads call "random" at the same time they will still get the same "random" number. Jonas And also generating a rand * getpid you can't really get good random number