Page 1 of 1

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

Posted: Fri 02 Dec 2011, 12:12
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?

Posted: Fri 02 Dec 2011, 12:30
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?

Posted: Fri 02 Dec 2011, 13:03
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

Almost there

Posted: Fri 02 Dec 2011, 18:42
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.

Posted: Fri 02 Dec 2011, 20:15
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.

Re: Almost there

Posted: Sat 03 Dec 2011, 03:05
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.

Posted: Sat 03 Dec 2011, 04:00
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)

Perhaps something for pwidgets

Posted: Sun 04 Dec 2011, 10:44
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/

Posted: Sun 04 Dec 2011, 14:19
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 


Glad I don't have a Mac

Posted: Sun 04 Dec 2011, 20:59
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

Posted: Thu 08 Dec 2011, 15:28
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.

Posted: Thu 08 Dec 2011, 16:57
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)!

Posted: Thu 15 Dec 2011, 23:49
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...

Posted: Fri 16 Dec 2011, 15:14
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.

Posted: Fri 16 Dec 2011, 15:15
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.

Posted: Tue 27 Dec 2011, 23:05
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

Posted: Thu 29 Dec 2011, 06:34
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);'