Subversion Repositories HelenOS-historic

Rev

Rev 623 | Rev 1062 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 623 Rev 625
Line 59... Line 59...
59
static void failed(void);
59
static void failed(void);
60
 
60
 
61
__u32 random(__u32 max)
61
__u32 random(__u32 max)
62
{
62
{
63
    __u32 rc;
63
    __u32 rc;
64
    ipl_t ipl;
-
 
65
 
64
 
66
    spinlock_lock(&lock);  
65
    spinlock_lock(&lock);  
67
    rc = seed % max;
66
    rc = seed % max;
68
    seed = (((seed<<2) ^ (seed>>2)) * 487) + rc;
67
    seed = (((seed<<2) ^ (seed>>2)) * 487) + rc;
69
    spinlock_unlock(&lock);
68
    spinlock_unlock(&lock);