elementary_functions: fix rand() with a single key letter after 02f1f9cd
[scilab.git] / scilab / modules / elementary_functions / sci_gateway / cpp / sci_rand.cpp
index b4090ad..f554d1f 100644 (file)
@@ -261,10 +261,22 @@ int setRandType(const wchar_t* _wcType)
     {
         return 0;
     }
-    else if (!wcscmp(_wcType,g_pwstTypeNormal))
+    if (!wcscmp(_wcType,g_pwstTypeNormal))
     {
         return 1;
     }
+
+    // shortcut version
+    if (_wcType[0] == g_pwstTypeUniform[0] && _wcType[1] == L'\0')
+    {
+        return 0;
+    }
+    if (_wcType[0] == g_pwstTypeNormal[0] && _wcType[1] == L'\0')
+    {
+        return 1;
+    }
+
+    // invalid key
     return -1;
 }
 /*--------------------------------------------------------------------------*/