Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Basic C Program.. Need Help!
New Posts  All Forums:Forum Nav:

Basic C Program.. Need Help! - Page 2

post #11 of 12
Quote:
Originally Posted by ghell View Post
If you mean which type of random number, it is pseudorandom.


I suppose it would matter if it is signed and can't return negative values, as it would limit the maximum value.
It returns a random pattern of bits - the fact that C interprets the return value as a signed integer does not make any difference to the number. The size of the integer (int vs long) makes a difference, but signed vs unsigned is the same on a binary level
It goes to eleven
(13 items)
 
  
CPUMotherboardGraphicsRAM
E6300 DS3 EVGA 8600GTS 2GB XMS2 DDR2-800 
Hard DriveOSMonitorKeyboard
1.294 TB Arch Linux/XP Samsung 226bw Eclipse II 
PowerCaseMouse
Corsair 520HX Lian-Li v1000B Plus G7 
  hide details  
Reply
It goes to eleven
(13 items)
 
  
CPUMotherboardGraphicsRAM
E6300 DS3 EVGA 8600GTS 2GB XMS2 DDR2-800 
Hard DriveOSMonitorKeyboard
1.294 TB Arch Linux/XP Samsung 226bw Eclipse II 
PowerCaseMouse
Corsair 520HX Lian-Li v1000B Plus G7 
  hide details  
Reply
post #12 of 12
Quote:
Originally Posted by rabidgnome229 View Post
It returns a random pattern of bits - the fact that C interprets the return value as a signed integer does not make any difference to the number. The size of the integer (int vs long) makes a difference, but signed vs unsigned is the same on a binary level
Yes, this is what I meant. If it was signed but couldn't return negative numbers, it would matter (because you effectively have 15 bits rather than 16, for example). If it is using a random bit pattern, it can obviously return negative numbers if the result is interpreted as a signed integer.

I was, however, under the impression that the pseudorandom numbers were not a random bit pattern but rather a table of mathematically pre-generated numbers that the seed simply indexes into cyclically.

C will not do enough type checking to complain with an implicit cast between unsigned and signed integers anyway.
Serene Power
(13 items)
 
  
CPUMotherboardGraphicsRAM
Dual Xeon E5620 Supermicro X8DAL-i EVGA 570HD SC 8GiB Corsair DDR3 1333 ECC-R 
Hard DriveOptical DriveOSMonitor
OCZ Agility 3 120GB SSD (+16TB NAS) LG 10x Blu-Ray Windows 7 x64 / Debian x64 Dell 2408WFP, P2411H 
PowerCase
850W CoolerMaster SilentPro M CoolerMaster Cosmos Pure 
  hide details  
Reply
Serene Power
(13 items)
 
  
CPUMotherboardGraphicsRAM
Dual Xeon E5620 Supermicro X8DAL-i EVGA 570HD SC 8GiB Corsair DDR3 1333 ECC-R 
Hard DriveOptical DriveOSMonitor
OCZ Agility 3 120GB SSD (+16TB NAS) LG 10x Blu-Ray Windows 7 x64 / Debian x64 Dell 2408WFP, P2411H 
PowerCase
850W CoolerMaster SilentPro M CoolerMaster Cosmos Pure 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Basic C Program.. Need Help!