diff --git a/lib/setup.php b/lib/setup.php
index c21c8be3957d7c9af37657679622df33a6dcd7b6..6d8430c1036e5dacc9a6b44cc85db468be4590b8 100644
--- a/lib/setup.php
+++ b/lib/setup.php
@@ -79,7 +79,8 @@ class OC_Setup {
 			}
 
 			//generate a random salt that is used to salt the local user passwords
-			$salt=mt_rand(1000,9000).mt_rand(1000,9000).mt_rand(1000,9000).mt_rand(1000,9000).mt_rand(1000,9000).mt_rand(1000,9000).mt_rand(1000,9000).mt_rand(1000,9000);
+			$random_bytes = openssl_random_pseudo_bytes(30, $cstrong);
+			$salt = bin2hex($random_bytes);
 			OC_Config::setValue('passwordsalt', $salt);
 
 			//write the config file