Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Ember from 'ember';
- const {
- computed
- } = Ember;
- export default Ember.Component.extend({
- items: null,
- random: computed('items', function(items) {
- const randomItems = [];
- const maxIndex = items.length - 1;
- while(randomItems.length !== items.length) {
- console.log(`Find random item from source and place in destination`);
- const randomIndex = Math.floor(Math.random() * maxIndex);
- const randomItem = items[randomIndex];
- // if(randomItems.indexOf(randomItem) !== -1) {
- randomItems.push(randomItem);
- // }
- }
- return randomItems;
- })
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement