diff --git a/lustre/ChangeLog b/lustre/ChangeLog
index bbbba9de679876ed69e9c29088ff35405d5cea80..3a13399d010529d24c902d017dc8e7f0dbd747c8 100644
--- a/lustre/ChangeLog
+++ b/lustre/ChangeLog
@@ -31,6 +31,10 @@ Severity   : enhancement
 Bugzilla   : 10651
 Description: Nanosecond timestamp support.
 
+Severity   : enhancement 
+Bugzilla   : 10802
+Description: Move random uuid functions to prng.c.
+
 --------------------------------------------------------------------------------
 
 tbd         Cluster File Systems, Inc. <info@clusterfs.com>
diff --git a/lustre/include/lustre_lib.h b/lustre/include/lustre_lib.h
index 451d16cbeb50fd547df10c5cbf13a0e7e8b17605..648946539c1dca744c2a62dfeda9d9aab966b511 100644
--- a/lustre/include/lustre_lib.h
+++ b/lustre/include/lustre_lib.h
@@ -42,6 +42,8 @@
 /* prng.c */
 unsigned int ll_rand(void);        /* returns a random 32-bit integer */
 void ll_srand(unsigned int, unsigned int);     /* seed the generator */
+void ll_get_random_bytes(void *buf, int size);
+void ll_generate_random_uuid(unsigned char uuid_out[16]);
 
 /* target.c */
 struct ptlrpc_request;
diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h
index dcd0876c1cba1c042182eed22cc3f4ae78a62e69..6275fb44e86fd1d3642b12efce75cf457a799f01 100644
--- a/lustre/include/obd_class.h
+++ b/lustre/include/obd_class.h
@@ -1404,7 +1404,6 @@ extern void obd_sysctl_clean (void);
 
 /* uuid.c  */
 typedef __u8 class_uuid_t[16];
-void class_generate_random_uuid(class_uuid_t uuid);
 void class_uuid_unparse(class_uuid_t in, struct obd_uuid *out);
 
 /* lustre_peer.c    */
diff --git a/lustre/liblustre/llite_lib.c b/lustre/liblustre/llite_lib.c
index 6f0c57037a2362ac5432b1aeaad9ef1221b29fd9..d179c10e69ae7c5f1f76da4cb99d105b7a0a7959 100644
--- a/lustre/liblustre/llite_lib.c
+++ b/lustre/liblustre/llite_lib.c
@@ -84,7 +84,7 @@ int liblustre_process_log(struct config_llog_instance *cfg,
         struct obd_connect_data *ocd = NULL;
         ENTRY;
 
-        generate_random_uuid(uuid);
+        ll_generate_random_uuid(uuid);
         class_uuid_unparse(uuid, &mgc_uuid);
 
         nid = libcfs_str2nid(mgsnid);
diff --git a/lustre/liblustre/llite_lib.h b/lustre/liblustre/llite_lib.h
index 7e4084a2f228c273cf6c8b38b1dd82f4a045fc97..3df6cad2ee41d7e7ce73bb5f3dbe56aa49046962 100644
--- a/lustre/liblustre/llite_lib.h
+++ b/lustre/liblustre/llite_lib.h
@@ -173,7 +173,6 @@ struct mount_option_s
         ((unsigned long)(ptr) == 0 || (unsigned long)(ptr) > -1000UL)
 
 /* llite_lib.c */
-void generate_random_uuid(unsigned char uuid_out[16]);
 int liblustre_process_log(struct config_llog_instance *cfg, char *mgsnid,
                           char *profile, int allow_recov);
 int ll_parse_mount_target(const char *target, char **mgsnid,
diff --git a/lustre/liblustre/lutil.c b/lustre/liblustre/lutil.c
index db203f37678210720e6f8068ae7626f5bd8ae38d..250c70e719c13fcc83884f28f6011ae4c4579640 100644
--- a/lustre/liblustre/lutil.c
+++ b/lustre/liblustre/lutil.c
@@ -129,32 +129,6 @@ void liblustre_init_random()
         ll_srand(tv.tv_sec ^ __swab32(seed[0]), tv.tv_usec ^__swab32(getpid()));
 }
 
-void get_random_bytes(void *buf, int size)
-{
-        int *p = buf;
-        int rem;
-        LASSERT(size >= 0);
-
-        rem = min((unsigned long)buf & (sizeof(int) - 1), size);
-        if (rem) {
-                int val = ll_rand();
-                memcpy(buf, &val, rem);
-                p = buf + rem;
-                size -= rem;
-        }
-
-        while (size >= sizeof(int)) {
-                *p = ll_rand();
-                size -= sizeof(int);
-                p++;
-        }
-        buf = p;
-        if (size) {
-                int val = ll_rand();
-                memcpy(buf, &val, size);
-        }
-}
- 
 static void init_capability(int *res)
 {
 #ifdef HAVE_LIBCAP
@@ -238,11 +212,6 @@ int liblustre_init_current(char *comm)
         return 0;
 }
 
-void generate_random_uuid(unsigned char uuid_out[16])
-{
-        get_random_bytes(uuid_out, sizeof(uuid_out));
-}
-
 int init_lib_portals()
 {
         int rc;
diff --git a/lustre/liblustre/super.c b/lustre/liblustre/super.c
index cb50b8deb9f43bc0ad37eb2127095378140d8bb2..8105df743b0f317a638ab4d8bed3d79fb036109f 100644
--- a/lustre/liblustre/super.c
+++ b/lustre/liblustre/super.c
@@ -1884,7 +1884,7 @@ llu_fsswop_mount(const char *source,
                 RETURN(-ENOMEM);
 
         INIT_LIST_HEAD(&sbi->ll_conn_chain);
-        generate_random_uuid(uuid);
+        ll_generate_random_uuid(uuid);
         class_uuid_unparse(uuid, &sbi->ll_sb_uuid);
 
         /* generate a string unique to this super, let's try
diff --git a/lustre/liblustre/tests/echo_test.c b/lustre/liblustre/tests/echo_test.c
index dcb31a06cda2f873a2cd661821e9c5372155818d..62a11de2c4a74f3c88123c0743f6dadb3d189d4f 100644
--- a/lustre/liblustre/tests/echo_test.c
+++ b/lustre/liblustre/tests/echo_test.c
@@ -96,9 +96,9 @@ static int connect_echo_client(void)
 	int err;
 	ENTRY;
 
-        generate_random_uuid(osc_uuid);
+        ll_generate_random_uuid(osc_uuid);
         class_uuid_unparse(osc_uuid, &osc_uuid_str);
-        generate_random_uuid(echo_uuid);
+        ll_generate_random_uuid(echo_uuid);
         class_uuid_unparse(echo_uuid, &echo_uuid_str);
 
         nid = libcfs_str2nid(echo_server_nid);
diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c
index a4778660c18fa6aaedd54fb9f39d685f71ff3184..b1fb5fca81363d09e1feeb0cc634bf0b8e046727 100644
--- a/lustre/llite/llite_lib.c
+++ b/lustre/llite/llite_lib.c
@@ -75,7 +75,7 @@ static struct ll_sb_info *ll_init_sbi(void)
         INIT_LIST_HEAD(&sbi->ll_conn_chain);
         INIT_LIST_HEAD(&sbi->ll_orphan_dentry_list);
 
-        class_generate_random_uuid(uuid);
+        ll_generate_random_uuid(uuid);
         class_uuid_unparse(uuid, &sbi->ll_sb_uuid);
         CDEBUG(D_HA, "generated uuid: %s\n", sbi->ll_sb_uuid.uuid);
 
@@ -702,7 +702,7 @@ static int old_lustre_process_log(struct super_block *sb, char *newprofile,
         int i, rc = 0, recov_bk = 1, failnodes = 0;
         ENTRY;
 
-        class_generate_random_uuid(uuid);
+        ll_generate_random_uuid(uuid);
         class_uuid_unparse(uuid, &mdc_uuid);
         CDEBUG(D_HA, "generated uuid: %s\n", mdc_uuid.uuid);
         
diff --git a/lustre/llite/super25.c b/lustre/llite/super25.c
index 9fb337ed10363438c861fd51046a12ddd77471ea..e56d77387d09994370b16c4346b01a1555cd4399 100644
--- a/lustre/llite/super25.c
+++ b/lustre/llite/super25.c
@@ -131,7 +131,7 @@ static int __init init_lustre_lite(void)
         lustre_register_client_fill_super(ll_fill_super);
         lustre_register_client_process_config(ll_process_config);
 
-        get_random_bytes(seed, sizeof(seed));
+        ll_get_random_bytes(seed, sizeof(seed));
 
         /* Nodes with small feet have little entropy
          * the NID for this node gives the most entropy in the low bits */
diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c
index 04d0802e968ca3ffd849a21c939ddba3c48905f2..bf9646b2f976debd9ffbe90a539f0db07c49caf6 100644
--- a/lustre/mds/handler.c
+++ b/lustre/mds/handler.c
@@ -1946,7 +1946,7 @@ static int mds_setup(struct obd_device *obd, obd_count len, void *buf)
         if (lcfg->lcfg_bufcount >= 4 && LUSTRE_CFG_BUFLEN(lcfg, 3) > 0) {
                 class_uuid_t uuid;
 
-                generate_random_uuid(uuid);
+                ll_generate_random_uuid(uuid);
                 class_uuid_unparse(uuid, &mds->mds_lov_uuid);
 
                 OBD_ALLOC(mds->mds_profile, LUSTRE_CFG_BUFLEN(lcfg, 3));
diff --git a/lustre/obdclass/class_obd.c b/lustre/obdclass/class_obd.c
index ccf80f3d8fa9838cf4207b3563bafeb56966436f..1684e728a029a61036342d669724dd77024847fe 100644
--- a/lustre/obdclass/class_obd.c
+++ b/lustre/obdclass/class_obd.c
@@ -412,7 +412,6 @@ EXPORT_SYMBOL(class_disconnect);
 EXPORT_SYMBOL(class_num2obd);
 
 /* uuid.c */
-EXPORT_SYMBOL(class_generate_random_uuid);
 EXPORT_SYMBOL(class_uuid_unparse);
 EXPORT_SYMBOL(lustre_uuid_to_peer);
 
diff --git a/lustre/obdclass/lustre_handles.c b/lustre/obdclass/lustre_handles.c
index 21d6f502322bd5bc91489c52e46777d19291fc46..9d4d1ecfd7cb05849dae5035760b5c75307d34aa 100644
--- a/lustre/obdclass/lustre_handles.c
+++ b/lustre/obdclass/lustre_handles.c
@@ -30,6 +30,7 @@
 
 #include <obd_support.h>
 #include <lustre_handles.h>
+#include <lustre_lib.h>
 
 spinlock_t handle_lock;
 static __u64 handle_base;
@@ -145,7 +146,7 @@ int class_handle_init(void)
              bucket--)
                 CFS_INIT_LIST_HEAD(bucket);
 
-        get_random_bytes(&handle_base, sizeof(handle_base));
+        ll_get_random_bytes(&handle_base, sizeof(handle_base));
         LASSERT(handle_base != 0ULL);
 
         return 0;
diff --git a/lustre/obdclass/obd_mount.c b/lustre/obdclass/obd_mount.c
index 30782b78e3a794747e27d2201b1ec6920b914205..0dd655ea16be91dca2af92e2992c3803cc22d0f6 100644
--- a/lustre/obdclass/obd_mount.c
+++ b/lustre/obdclass/obd_mount.c
@@ -640,7 +640,7 @@ static int lustre_start_mgc(struct super_block *sb)
 
         /* Random uuid for MGC allows easier reconnects */
         OBD_ALLOC_PTR(uuid);
-        class_generate_random_uuid(uuidc);
+        ll_generate_random_uuid(uuidc);
         class_uuid_unparse(uuidc, uuid);
 
         /* Start the MGC */
diff --git a/lustre/obdclass/prng.c b/lustre/obdclass/prng.c
index b3c2a753e01ca8313538ad5a1f542a6e40288b2d..bd419082b5aa5652374113b8eb8ddb9d3b1db65f 100644
--- a/lustre/obdclass/prng.c
+++ b/lustre/obdclass/prng.c
@@ -15,8 +15,10 @@
 
 #ifndef __KERNEL__
 #include <liblustre.h>
+#define get_random_bytes(val, size)     (*val) = 0
 #endif
 #include <obd_class.h>
+#include <linux/random.h>
 
 /*
 From: George Marsaglia <geo@stat.fsu.edu>
@@ -66,3 +68,40 @@ void ll_srand(unsigned int seed1, unsigned int seed2)
 		seed_y = seed2;
 }
 EXPORT_SYMBOL(ll_srand);
+
+void ll_get_random_bytes(void *buf, int size)
+{
+        int *p = buf;
+        int rem, tmp;
+
+        LASSERT(size >= 0);
+
+        rem = min((int)((unsigned long)buf & (sizeof(int) - 1)), size);
+        if (rem) {
+                get_random_bytes(&tmp, sizeof(tmp));
+                tmp ^= ll_rand();
+                memcpy(buf, &tmp, rem);
+                p = buf + rem;
+                size -= rem;
+        }
+
+        while (size >= sizeof(int)) {
+                get_random_bytes(&tmp, sizeof(tmp));
+                *p = ll_rand() ^ tmp;
+                size -= sizeof(int);
+                p++;
+        }
+        buf = p;
+        if (size) {
+                get_random_bytes(&tmp, sizeof(tmp));
+                tmp ^= ll_rand();
+                memcpy(buf, &tmp, size);
+        }
+}
+EXPORT_SYMBOL(ll_get_random_bytes); 
+
+void ll_generate_random_uuid(unsigned char uuid_out[16])
+{
+        ll_get_random_bytes(uuid_out, sizeof(uuid_out));
+}
+EXPORT_SYMBOL(ll_generate_random_uuid);
diff --git a/lustre/obdclass/uuid.c b/lustre/obdclass/uuid.c
index 09302bdbd39d4306a072bfed2f35c0600f6304a7..ad072ff71dffc4b0a237fac4a08a856a0c022a29 100644
--- a/lustre/obdclass/uuid.c
+++ b/lustre/obdclass/uuid.c
@@ -125,28 +125,6 @@ int class_uuid_parse(struct obd_uuid in, class_uuid_t uu)
 
 void generate_random_uuid(unsigned char uuid_out[16]);
 
-/* We need to have some extra twiddling here because some systems have
- * no random state when they start up. */
-void class_generate_random_uuid(class_uuid_t uuid)
-{
-        struct timeval t;
-        int *i, j, k;
-
-        LASSERT(sizeof(class_uuid_t) % sizeof(*i) == 0);
-
-        j = jiffies;
-        do_gettimeofday(&t);
-        k = t.tv_usec;
-
-        generate_random_uuid(uuid);
-
-        for (i = (int *)uuid; (char *)i < (char *)uuid + sizeof(class_uuid_t); i++) {
-                *i ^= j ^ k;
-                j = ((j << 8) & 0xffffff00) | ((j >> 24) & 0x000000ff);
-                k = ((k >> 8) & 0x00ffffff) | ((k << 24) & 0xff000000);
-        }
-}
-
 void class_uuid_unparse(class_uuid_t uu, struct obd_uuid *out)
 {
         struct uuid uuid;