comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: random integers between 0 and 1,000,000
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: random integers between 0 and 1,000,000 [message #46047 is a reply to message #45956] Mon, 24 October 2005 12:06 Go to previous message
James Kuyper is currently offline  James Kuyper
Messages: 425
Registered: March 2000
Senior Member
Norbert Hahn wrote:
> "James Kuyper" <kuyper@wizard.net> wrote:
>
>> takes a 32 bit unsigned long with a value somewhere in the range from 0
>> to 1000000, and converts it into a 16 bit signed int, with a range from
>> -32768 to 32767.
>
> I took a closer look on what might have gone on. I ran the following
> program:
>
> z = randomu(seed,30)
> a = long (z*1000000) & print, a
> b = ulong (z*1000000) & print, b
> i = fix(a)
> print, a
>
> I found that a(1) was negative (-20848). So I printed

I was unable to reproduce that result. I tested with several million
random numbers, and never once got a negative value from
long(1000000*randomu(seed,N)). Could you identify the value of z[1]
that gave you that value for a[1]?
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Problem: Opening a 20-30MB sized ShapeFile
Next Topic: Keeping Button Pressed In?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 08:56:46 PDT 2025

Total time taken to generate the page: 0.00282 seconds