What's new

[Q] [Solved] Shell Ramdom Number

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

peepsnet

Regular Contributor
I am not able to generate a random number or use Arrays in a script

/bin/sh

not

/bin/bash

How can I generate a random number??
 
Went with:
Code:
RND=$(printf "%d" 0x$(openssl rand -hex 2))
RND2=$(( RND * N / 65536 + BASE ))
 

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top