HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: unknown math function "rand"
Operating System - HP-UX
1837182
Members
2624
Online
110113
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2004 04:34 PM
02-08-2004 04:34 PM
unknown math function "rand"
Hi All,
I have a script that using rand function. When I tried to run it, I got an error below. Anyone know what the issue? Is there any patch need to be installed to resolve the issue? Please help.
Thanks.
Negara
unknown math function "rand"
while executing
"expr {int($m*rand())}"
(procedure "rand" line 3)
invoked from within
"rand 2"
invoked from within
"set isleft [rand 2]..."
invoked from within
"set initially_left [set isleft [rand 2]]..."
(file "./mkpasswd" line 108)
I have a script that using rand function. When I tried to run it, I got an error below. Anyone know what the issue? Is there any patch need to be installed to resolve the issue? Please help.
Thanks.
Negara
unknown math function "rand"
while executing
"expr {int($m*rand())}"
(procedure "rand" line 3)
invoked from within
"rand 2"
invoked from within
"set isleft [rand 2]..."
invoked from within
"set initially_left [set isleft [rand 2]]..."
(file "./mkpasswd" line 108)
Santos
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2004 05:02 PM
02-08-2004 05:02 PM
Re: unknown math function "rand"
RAND(3) Linux Programmerâ s Manual RAND(3)
NAME
rand, srand - random number generator.
SYNOPSIS
#include
int rand(void);
void srand(unsigned int seed);
DESCRIPTION
The rand() function returns a pseudo-random integer between 0 and
RAND_MAX.
The srand() function sets its argument as the seed for a new sequence
of pseudo-random integers to be returned by rand(). These sequences
are repeatable by calling srand() with the same seed value.
If no seed value is provided, the rand() function is automatically
seeded with a value of 1.
Seems like a standard function to me.
S
NAME
rand, srand - random number generator.
SYNOPSIS
#include
int rand(void);
void srand(unsigned int seed);
DESCRIPTION
The rand() function returns a pseudo-random integer between 0 and
RAND_MAX.
The srand() function sets its argument as the seed for a new sequence
of pseudo-random integers to be returned by rand(). These sequences
are repeatable by calling srand() with the same seed value.
If no seed value is provided, the rand() function is automatically
seeded with a value of 1.
Seems like a standard function to me.
S
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2004 05:24 PM
02-08-2004 05:24 PM
Re: unknown math function "rand"
I'm a bit confused here, what language is this script written with? It almost looks like shell but almost looks like C too.
If you are using C then you need to include stdlib as SEP points out above. If you are using shell, you need to use the $RANDOM (which is a bit rubbish really). It looks like whichever language you are using here doesn't have the "rand()" function you are looking for.
If you are using C then you need to include stdlib as SEP points out above. If you are using shell, you need to use the $RANDOM (which is a bit rubbish really). It looks like whichever language you are using here doesn't have the "rand()" function you are looking for.
Never preceed any demonstration with anything more predictive than "watch this"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2004 08:55 PM
02-08-2004 08:55 PM
Re: unknown math function "rand"
As Mark Grant said, this looks a bit like C but some parts read like a shell script... is this Perl?
If it is, the next question will be: which version? "perl -v" will tell you that.
Older releases of HP-UX 11.0 had a very old Perl version by default. There are depots of
Perl 5.6.1 and Perl 5.8 available for free at software.hp.com: look in "development tools".
If it is, the next question will be: which version? "perl -v" will tell you that.
Older releases of HP-UX 11.0 had a very old Perl version by default. There are depots of
Perl 5.6.1 and Perl 5.8 available for free at software.hp.com: look in "development tools".
MK
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP