Sponsored Content
Full Discussion: mod on %RANDOM
Top Forums Shell Programming and Scripting mod on %RANDOM Post 302271837 by er_zeeshan05 on Sunday 28th of December 2008 03:22:44 PM
Old 12-28-2008
Hammer & Screwdriver mod on %RANDOM

I use %random to generate random number but i want to mod it so i get random number below 50 only in ksh script
how can i do it
x=random % 50
doesn't work

help is appreciated.


Is there any other way i get generate random number below 50 in ksh.any other function.
Plz provide an example

i am fairly new to unix
thanks
 

3 More Discussions You Might Find Interesting

1. Programming

Mod

I try to use mod(a,b) in a program but i cant Please help me (2 Replies)
Discussion started by: iwbasts
2 Replies

2. Ubuntu

expect script for random password and random commands

Hi I am new to expect. Please if any one can help on my issue its really appreciable. here is my issue: I want expect script for random passwords and random commands generation. please can anyone help me? Many Thanks in advance (0 Replies)
Discussion started by: vanid
0 Replies

3. Shell Programming and Scripting

Need to generate a file with random data. /dev/[u]random doesn't exist.

Need to use dd to generate a large file from a sample file of random data. This is because I don't have /dev/urandom. I create a named pipe then: dd if=mynamed.fifo do=myfile.fifo bs=1024 count=1024 but when I cat a file to the fifo that's 1024 random bytes: cat randomfile.txt >... (7 Replies)
Discussion started by: Devyn
7 Replies
Tspi_TPM_GetRandom(3)					     Library Functions Manual					     Tspi_TPM_GetRandom(3)

						     TCG Software Stack Developer's Reference

NAME
Tspi_TPM_GetRandom - generate a random number on the TPM SYNOPSIS
#include <tss/platform.h> #include <tss/tcpa_defines.h> #include <tss/tcpa_typedef.h> #include <tss/tcpa_struct.h> #include <tss/tss_typedef.h> #include <tss/tss_structs.h> #include <tss/tspi.h> TSS_RESULT Tspi_TPM_GetRandom(TSS_HTPM hTPM, UINT32 size, BYTE** random); DESCRIPTION
Tspi_TPM_GetRandom gets a good random number for the purpose of generating symmetric keys, nonces, or seeding a random number generator. PARAMETERS
hTPM The hTPM parameter is used to specify the handle of the TPM object. The command to get the TPM to test itself will be sent here. size The size parameter is the number of random bytes requested. random The random parameter is a pointer to memory containing the random data. This is where the generated number goes. Because this internally allocates memory, Tspi_Context_FreeMemory should also be used. RETURN CODES
Tspi_TPM_GetRandom returns TSS_SUCCESS on success, otherwise one of the following values is returned: TSS_E_INVALID_HANDLE hTPM is not a valid handle. TSS_E_INTERNAL_ERROR An internal SW error has been detected. TSS_E_BAD_PARAMETER One or more parameters is bad. CONFORMING TO
Tspi_TPM_GetRandom conforms to the Trusted Computing Group Software Specification version 1.1 Golden SEE ALSO
Tspi_Context_FreeMemory(3). TSS 1.1 2004-05-25 Tspi_TPM_GetRandom(3)
All times are GMT -4. The time now is 03:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy