Changeset 3582:e12da3821240 in orange


Ignore:
Timestamp:
04/24/07 23:18:35 (7 years ago)
Author:
janezd <janez.demsar@…>
Branch:
default
Convert:
373a299f72a5c8581c5dccb3436afb7d31350ada
Message:
  • fixed a crash when getting a random element of an empty distribution
File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/orange/distvars.cpp

    r2547 r3582  
    871871{  
    872872  float ri = (random & 0x7fffffff) / float(0x7fffffff); 
     873  if (!abs || !size()) 
     874    raiseError("cannot return a random element of an empty distribution"); 
     875  ri = fmod(ri, abs); 
    873876  const_iterator di(begin()); 
    874877  while (ri > *di) 
     
    880883int TDiscDistribution::randomInt() 
    881884{  
     885  if (!abs || !size()) 
     886    raiseError("cannot return a random element of an empty distribution"); 
     887 
    882888  if (!randomGenerator) 
    883889    randomGenerator = mlnew TRandomGenerator; 
Note: See TracChangeset for help on using the changeset viewer.