/    Sign up×
Community /Pin to ProfileBookmark

New here. Need help finding a code.

I am wondering if anyone knows of an easy to use online tool (javascript maybe?), that will scramble a list of names for me? I would like to have access to one for a hobby I have. I currently have a long list of names and would like to be able to scramble up the names, as they are currently in alphabetical order. And want to do this for an on going game with some groups I belong to. Hope I made everything clear. Thank you for any help you can offer! ?

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@Declan1991Jun 29.2008 — Have all the names separated by a comma ("A,B,C,D"), and use this:<i>
</i>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;script type="text/javascript"&gt;
var A=[color=red]"A,B,C,D"[/color].split(",");[color=green]// The only thing you have to change.[/color]
var B=[],l=A.length,r;
while (l--) {
r=Math.floor(Math.random()*A.length);
B[l] = A[r];
A.splice(r,1)
}
document.write(B.join("&lt;br&gt;"));
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
Copy linkTweet thisAlerts:
@jandtsmomauthorJun 29.2008 — Well, I don't know what I did wrong, but this didn't work. I am not sure this is exactly what I was looking for. The names are in list form, like this

Adelita

Alexandre

Alicia

Allie

it took for-ev-er to put the commas after each name, and equally long to put them in the form the A,B,C,D were listed in the script. When I finished editing it in the javascript editor at my website, when I went to see it, there was nothing to see. It was completley blank. I am not experienced with scripts and such, so maybe I did something wrong. Is there an easier, less time consuming code? ? I do appreciate your reply and help.
Copy linkTweet thisAlerts:
@Declan1991Jun 29.2008 — Pity you didn't say what way they were, but here is an alternative that is more self-contained. It's a full page, so save in as .html in a simple text editor (i.e. Notepad for Windows).<i>
</i>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form name="form1"&gt;
&lt;textarea rows="10" cols="30" name="ordered"&gt;Adelita
Alexandre&lt;/textarea&gt;
&lt;textarea rows="10" cols="30" name="unordered"&gt;&lt;/textarea&gt;
&lt;input type="button" value="Rearrange" onclick="rearrange();"&gt;
&lt;script type="text/javascript"&gt;
function rearrange(){
var A=document.form1.ordered.value.split("n");// The only thing you have to change.
var B=[],l=A.length,r;
while (l--) {
r=Math.floor(Math.random()*A.length);
B[l] = A[r];
A.splice(r,1)
}
document.form1.unordered.value = B.join("n");
}
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;

It depends on how you want it to run. It's a little hard to know without knowing anything else about the page.
×

Success!

Help @jandtsmom spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.6,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...