Is there a random number generator for Puppy? (Solved)

Requests go here. If you fill a request, give it a new thread in the appropriate category and then link to it in the request thread.
Post Reply
Message
Author
Dromeno
Posts: 534
Joined: Fri 12 Sep 2008, 07:01

Is there a random number generator for Puppy? (Solved)

#1 Post by Dromeno »

Currently I am learning memorizing techniques for random numbers to improve my visualization capabilities (read Foer's Moonwalking with Einstein if you want to know why)

Is there a program which offline does what this site does:

http://www.random.org/strings/

Does such a random number generator exists as pet?

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#2 Post by Flash »

I seem to remember a thread years ago about generating random numbers in Puppy. Have you tried searching the forum for other posts with the word random in them? Or random number generator?

stu90

#3 Post by stu90 »

Paste one of these into terminal - or make a script and run from terminal:

Mixed letters (lower and upper case) and numbers:
cat /dev/urandom| tr -dc 'a-zA-Z0-9' | fold -w 10| head -n 10


Mixed letters (upper case only) and numbers:
cat /dev/urandom| tr -dc 'A-Z0-9' | fold -w 10| head -n 10


Numbers only:
cat /dev/urandom| tr -dc '0-9' | fold -w 10| head -n 10

fold -w 10 - is the amount of numbers on each line.
head -n 10 - is the amount of lines.
Change the numbers if you want more or less numbers/lines.

example output numbers:
2358050481
8314333229
5764338769
2275964781
4952461006
7813938010
7352332659
8528802348
5485997065
1874076173

example output mixed:
iBMAwghUnz
P8LL2M5Bae
wjvw5ofoh9
Hc28U2BE00
sJSFBbsL1F
6u8oENfSNf
brKzmmwya3
nyvf6JMlRD
nvrRK8ElEZ
MfaDglBaDM

Dromeno
Posts: 534
Joined: Fri 12 Sep 2008, 07:01

Almost there

#4 Post by Dromeno »

He. thanks...

One more question for the script - what is the command to make lxterminal show the numbers and not disappear immediately? It works when I open lxterminal then type or copypaste the line

cat /dev/urandom| tr -dc '0-9' | fold -w 10| head -n 10

...but I want to make it into a simple icon which I can click to get the numbers in lxterminal without opening the lxterminal first.

User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

#5 Post by jrb »

You can also open gnumeric, Calc on the desktop, and type in:

Code: Select all

=rand()
which will give you a number between 0 and 1. If you want them bigger type

Code: Select all

=rand()*1000
or 1000000 or whatever.

User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

Re: Almost there

#6 Post by jrb »

Dromeno wrote:He. thanks...

One more question for the script - what is the command to make lxterminal show the numbers and not disappear immediately? It works when I open lxterminal then type or copypaste the line

cat /dev/urandom| tr -dc '0-9' | fold -w 10| head -n 10

...but I want to make it into a simple icon which I can click to get the numbers in lxterminal without opening the lxterminal first.
Create a new script, i.e. random_numbers, and type in the following:

Code: Select all

#!/bin/sh
xterm -hold -e "cat /dev/urandom| tr -dc '0-9' | fold -w 10| head -n 10"
Drag it to the desktop and you will have your numbers in a readable terminal window.

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#7 Post by 01micko »

I like that snippet stu90... dunno why I but I felt compelled to make a silly little Xdialog..

Code: Select all

#!/bin/ash
while [ 1 ]
 do 
 VAR=$(cat /dev/urandom| tr -dc 'A-Z0-9' | fold -w 10| head -n 10)
  Xdialog -yesno "$VAR \n\nGenerate More?" 0 0
  case $? in
  0)
  unset VAR
  sleep 0.5
  ;;
  *)break
  ;;esac
 done
 
8)
Puppy Linux Blog - contact me for access

Dromeno
Posts: 534
Joined: Fri 12 Sep 2008, 07:01

Perhaps something for pwidgets

#8 Post by Dromeno »

Thanks again! For anyone who wants to try it (surry for my ranting...I am amazed by the results) after reading Moonwalking with einstein I read this one http://www.amazon.com/Quantum-Memory-Po ... 0743528662, practiced a bit, and in less than a week I can memorize a 25 digit number in ten minutes. And remember it three days later. I have no idea of a good application yet but it definately is a fun technique to win bar bets.

But to return to the subject of this post. With this site you can make a true randomness producing widget. Perhaps a nice addition to pwidgets (random number block of the day)? It would be the most useful, I think, if you were able to choose the length and width of the column.

http://www.random.org/widgets/integers/

stu90

#9 Post by stu90 »

Following on from 01micko's xdialog GUI - here is a yad GUI with format, character and column length options. :)

Image

Code: Select all

#!/bin/bash

## stu90 ##
## random number / letter / mixed generator ##
## root password for user fido ###
[ "`whoami`" != "root" ] && exec sudo -A ${0} ${@}

TITLE="Randomizer"
TEXT=" Make a random memory string "
FORMAT="mixed!numbers!letters"

GUI=$( yad --title="$TITLE" --text="$TEXT" --form \
--field="Format:CB" "$FORMAT" \
--field="Character:NUM" "10" \
--field="Columns:NUM" "10" --button="gtk-ok" )

 GETFORM=`echo $GUI | cut -d '|' -f1`
 GETCHAR=`echo $GUI | cut -d '|' -f2 | cut -d '.' -f1`
 GETCOLU=`echo $GUI | cut -d '|' -f3 | cut -d '.' -f1` 

if `echo "$GETFORM" | grep -q mixed` ; then
  cat /dev/urandom| tr -dc 'A-Z0-9' | fold -w "$GETCHAR"| head -n "$GETCOLU" | yad --title="$TITLE" --height="275" --text-info
elif `echo "$GETFORM" | grep -q numbers` ; then
  cat /dev/urandom| tr -dc '0-9' | fold -w "$GETCHAR"| head -n "$GETCOLU" | yad --title="$TITLE" --height="275" --text-info
elif `echo "$GETFORM" | grep -q letters` ; then
  cat /dev/urandom| tr -dc 'A-Z' | fold -w "$GETCHAR"| head -n "$GETCOLU" | yad --title="$TITLE" --height="275" --text-info
fi 


Dromeno
Posts: 534
Joined: Fri 12 Sep 2008, 07:01

Glad I don't have a Mac

#10 Post by Dromeno »

wow... It are threads like this, with lots of helpful geeks hobbyists and other humans which makes me love linux so much in comparison to, for instance...

http://edcooke.memrise.com/2011/05/is-a ... tally.html

I have a lucid puppy 525 running on an asus eee 1215n, running one and a half times as fast as a MacPro for 1/4 of the costs plus a top notch helpful forum

stu90

#11 Post by stu90 »

Hi Dromeno - I might try using this my self any tips on how to remember the strings?

I also updated my script/GUI to incorporate a random word list generator - any interest in this?

cheers.

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#12 Post by vovchik »

Dear Stu,

It's tiny and great, so thanks. The only thing I would do is change the 'Columns' label for the spinbox to Rows, since that is what we seem to be dealing with :) Don't worry. I can't tell right from left without looking at my hands. Really :) And, strictly speaking, x and y are relative.

With kind regards,
vovchik

PS. I recently got the latest Yad and compiled it (Anansik is up to 0.16.3)!

Dromeno
Posts: 534
Joined: Fri 12 Sep 2008, 07:01

#13 Post by Dromeno »

stu,

One useful forum about such memory techniques is
http://mnemotechnics.org/x/

The audiobook by Dominic O'Brian about "quantum memory techniques" can be downloaded from filestube (but I think it is more legal to buy it). Weird name, quantum memory technique, since a quantum leap is by definition the smallest possible change in nature, so I guess it is more a title intended to boost sales. There is no new age magic stuff involved.

It is more a kind of mental zip for numeral information. It is a kind of mental-visual language. If you picture a single given digit in ten different colors (for instance transparent, red, orange, yellow, green, blue, violet, black, white, gold) then you can mentally encode/remember all numbers between 1-100 by just 10 digits. With little practice in the same direction it is possible to condense all numbers between 1 and 999,999 with just 1 mental picture etc. Remembering pics is way easier than remembering strings of numbers.

Basically this is the technique which memory champions use to remember ten thousands digits of pi. And other than just trying to remember long strings by reading/repeating, visulalization is something you can train for. So thanks again for your little piece of software. Being able to remember a copuple of dozen random digits is a fun thing to amaze friends and a nice "mind game" to practice. Some people like to do tetris. I like to train remembering random number blocks...

stu90

#14 Post by stu90 »

vovchik wrote:Dear Stu,

It's tiny and great, so thanks. The only thing I would do is change the 'Columns' label for the spinbox to Rows, since that is what we seem to be dealing with :) Don't worry. I can't tell right from left without looking at my hands. Really :) And, strictly speaking, x and y are relative.

With kind regards,
vovchik

PS. I recently got the latest Yad and compiled it (Anansik is up to 0.16.3)!
Thanks Volchik - yes the colums label needs to be changed :oops: :D

cheers.

stu90

#15 Post by stu90 »

Dromeno wrote:stu,

One useful forum about such memory techniques is
http://mnemotechnics.org/x/

The audiobook by Dominic O'Brian about "quantum memory techniques" can be downloaded from filestube (but I think it is more legal to buy it). Weird name, quantum memory technique, since a quantum leap is by definition the smallest possible change in nature, so I guess it is more a title intended to boost sales. There is no new age magic stuff involved.

It is more a kind of mental zip for numeral information. It is a kind of mental-visual language. If you picture a single given digit in ten different colors (for instance transparent, red, orange, yellow, green, blue, violet, black, white, gold) then you can mentally encode/remember all numbers between 1-100 by just 10 digits. With little practice in the same direction it is possible to condense all numbers between 1 and 999,999 with just 1 mental picture etc. Remembering pics is way easier than remembering strings of numbers.

Basically this is the technique which memory champions use to remember ten thousands digits of pi. And other than just trying to remember long strings by reading/repeating, visulalization is something you can train for. So thanks again for your little piece of software. Being able to remember a copuple of dozen random digits is a fun thing to amaze friends and a nice "mind game" to practice. Some people like to do tetris. I like to train remembering random number blocks...
Thanks Dromeno - i will check it out, i need all the help i can get in the memory department! :idea:

cheers.

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#16 Post by Pizzasgood »

You can also do this from the shell, to get a number from 0 - 32767:

Code: Select all

echo $RANDOM
http://tldp.org/LDP/abs/html/randomvar.html
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

User avatar
GustavoYz
Posts: 883
Joined: Wed 07 Jul 2010, 05:11
Location: .ar

#17 Post by GustavoYz »

Pizzasgood wrote:You can also do this from the shell, to get a number from 0 - 32767:

Code: Select all

echo $RANDOM
http://tldp.org/LDP/abs/html/randomvar.html
And, from 0 to any other number (5 in this case), like this:

Code: Select all

echo $[$RANDOM%6]
For floats, u can use somethig like this:

Code: Select all

perl -le 'print rand(6);'

Post Reply